开发者

Rails 3 - Multiple Currencies

开发者 https://www.devze.com 2023-03-25 00:14 出处:网络
If I do this: number_to_currency(100,:locale=>\'en-GB\') I\'d expect to get something like this: £100.00

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消