Rails 3-多种货币 [英] Rails 3 - Multiple Currencies

查看:96
本文介绍了Rails 3-多种货币的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我这样做:

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

我希望得到这样的东西:

I'd expect to get something like this:

£100.00

但是我得到

$100

如果我输入语言环境:en,'fr-FR'或其他内容,则相同。

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

Rails是否具有基于语言环境的默认货币列表,还是我必须为地球上每个国家/地区自己设置I18映射

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?

任何帮助表示赞赏。

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

这篇关于Rails 3-多种货币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆