    # File lib/ramaze/helper/localize.rb, line 37
            def translate(string, locales, substitute)
              target = string.to_s.dup
              locales = locales.flatten.uniq

              if substitute
                substitute.each do |key, value|
                  target.gsub!(/\{#{Regexp.escape(key)}\}/, lookup(value, locales))
                end
                return target
              elsif target =~ /\{/
                target.gsub!(/\{([^\}]+)\}/){ lookup($1, locales) }
                return target
              else
                lookup(target, locales)
              end
            end