How do I interrogate a given locale for it’s currency unit?
Obviously, I can parse my own Yaml translation files, but I’m assuming
that there is a simpler way to do it via a direct call to I18n, perhaps?
Thanks,
Wes
How do I interrogate a given locale for it’s currency unit?
Obviously, I can parse my own Yaml translation files, but I’m assuming
that there is a simpler way to do it via a direct call to I18n, perhaps?
Thanks,
Wes
Answer:
I18n.translate(‘number.currency.format.unit’, :locale => ‘’)
W
Also remember there is a built-in i18n support for some methods, e.g.:
ruby-1.9.2-p0 > I18n.locale = :pl
=> :pl
ruby-1.9.2-p0 > number_to_currency 12.34
=> “12,34 PLN”
ruby-1.9.2-p0 > I18n.locale = :en
=> :en
ruby-1.9.2-p0 > number_to_currency 12.34
=> “$12.34”
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs