Rails 3 - Multiple Currencies

江枫思渺然 提交于 2019-12-24 07:35:12

问题


If I do this:

number_to_currency(100,:locale=>'en-GB')

I'd expect to get something like this:

£100.00

But instead I'm getting

$100

This is the same if I pass in the locale :en, 'fr-FR' or whatever.

Does Rails have a default list of currencies based on locale, or do I have to setup the I18 mappings for every country on the planet myself?

Any help appreciated.

Tobin


回答1:


In the locale file, the currency unit is defined via

number:
  currency:
    unit:    "$"

You have to do it yourself. This may help:

https://github.com/rails/rails/blob/master/actionpack/lib/action_view/locale/en.yml



来源:https://stackoverflow.com/questions/6939089/rails-3-multiple-currencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!