大礼包本地化产品展示_价格

时间:2019-01-15 15:55:04

标签: ruby-on-rails ruby-on-rails-5 spree

我正在构建一个spree应用程序,并且我使用spree_globalize和spree_i18n进行本地化,并且一切正常,除非我找不到一种方法来对display_price进行本地化!

我的默认货币是EGP,如果要在en上显示,我希望它显示为'100 EGP',在语言环境是ar时,我希望它显示为'١٠٠ج.م'

这是我的代码

  egp = Money::Currency.entries.select { |m| m.iso_code == 'EGP' }.first
  Money::Currency.register(
    priority: egp.priority,
    iso_code: egp.iso_code,
    iso_numeric: egp.iso_numeric,
    name: egp.name,
    symbol: 'EGP',
    alternate_symbols: ['ج.م', 'EGP', 'LE'],
    subunit: egp.subunit,
    subunit_to_unit: egp.subunit_to_unit,
    symbol_first: false, # egp.symbol_first,
    decimal_mark: egp.decimal_mark,
    html_entity: 'EGP', # what is displayed on the web interface
    thousands_separator: egp.thousands_separator,
    smallest_denomination: egp.smallest_denomination,
    separator: egp.separator,
    delimiter: egp.delimiter
  )

0 个答案:

没有答案