My favorites | Sign in
Project Logo
                
Search
for
Updated Aug 01, 2007 by mattAimonetti
Labels: Featured, Phase-Design
RailsLocalization  

Rails Localization

Localize a time object by using a predefined format (defined in the date_helper_time_formats variable that you can find in globalite/lang/rails/lang.yml)

Globalite.language = :fr
Time.now.l(:long)

Localize a date object by using a predefined format (defined in the date_helper_date_formats variable that you can find in globalite/lang/rails/lang.yml)

Date.today.l

In your views, create a select box with a list of all countries(listed in the locale language):

country_options_for_select

In your views, create a select box with a list of all the months(listed in the locale language) with the current month selected:

select_month(Time.now)
In your views, create a set of html select-tags (one for year, month, day, hour, and minute):
select_datetime
In your views, create a set of html select-tags (one for year, month, and day):
select_date
Get a number returned in currency, for instance if the locale was set to 'fr' the returned value would be 123,00 € but if the locale was set to 'en-US' it would return $123.00
number_to_currency(123)

Get a distance of time in words localized.

distance_of_time_in_words(10.minutes.ago, Time.now)

Active record errors are automatically rendered in the locale language.

Submit your Rails language file in your own language to mattAimonetti@gmail.com


Comment by rieraraul, Jun 27, 2008

I assume this is deprecated for Rails 2.1, because the file "globalite/lang/rails/lang.yml" is NOT there

Comment by drkwolf, Aug 12, 2008

hi, how to localize message & flash errors for example :

validates_length_of :email,

:within => 5..100, :message => "Password must be at least 5 characters."

Comment by vergleichmich, Dec 12, 2008

is there a localization for number_with_delimiter?


Sign in to add a comment
Hosted by Google Code