Here's a better dummy method that also handles the 
"this is %{jo}" % {:jo => "so"} cases.

class Object
  def self._(msg)
    return msg
  end
  def _(msg)
    return msg
  end
end

class String
  alias :__old_format_m :%
  def %(hash = {})
    if hash.kind_of?(Hash)
      ret = dup
      hash.keys.each do |key, value|
        ret.gsub!("\%\{#{key}\}", value.to_s)
      end
      return ret
    else
      ret = gsub(/%\{/, '%%{')
      ret.__old_format_m(hash)
    end
  end
end

Wybo

- Looking forward to a working rails 2.2 gettext plugin.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to