Jesper Rønn-Jensen
2007-Sep-18 14:49 UTC
distance_of_time_in_words hardcoded strings should be separated for easier localization
Hi everybody.
After DHHs talk at RailsConf yesterday, it''s essential that some of
you can rectify this patch for ruby on Rails
Please help me an have a look at
http://dev.rubyonrails.org/ticket/9587
Thanks!
Jesper Rønn-Jensen
blog: www.justaddwater.dk
====ActiveRecord::Errors has a placeholder (@@default_error_messages) for
messages that can be overridden.
Just the same way, the hardcoded time strings should be easily
overridden without breaking or re-implementing the logic in
distance_of_time_in_words.
This patch creates a new placeholder for the hardcoded strings:
@@time_messages = {
:less_than_x_seconds => "less than %d seconds",
:half_a_minute => "half a minute",
...
}
Now you are able to overwrite with
Helpers::DateHelpers::time_messages[:less_than_x_seconds] = "an
instant"
or similar. I also added some lines of documentation for overriding,
as well as ran the tests which pass.
Please
a) verify that this works for you
b) vote +1 for it
c) try it out in your environment
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
