jeffp / enumerated_attribute

Easy enum for your models, objects and views
MIT License
190 stars 63 forks source link

Localisation #54

Open aklein-dex opened 12 years ago

aklein-dex commented 12 years ago

In my project, I'm using enumerated_attribute, but I need to display the options in the right language. I added a new options ":localize", and if it's set to true, then the labels are translated. Example:

enum_attr :currency, %w(en ja), :init => I18n.locale, :localize => true do 
  label :en => "dollar"
  label :ja => "yen"
end

Then if the website is in Japanese I will see 円 and if it is in English I will see ¥.