How to use `alternate_symbols` with localization?
Hessah95 opened this issue · 2 comments
Hello, I have an issue with translating the currency.
I followed the instructions as mentioned here: https://github.com/RubyMoney/money#localization
and for example, I want the currency in English to be "KWD" and in Arabic "د.ك"
in Money initializer; I added the following to override the defaults:
config.register_currency = {
priority: 100,
iso_code: "KWD",
name: "Kuwaiti Dinar",
symbol: "KWD",
alternate_symbols: ["د.ك"],
symbol_first: false,
subunit: "Fils",
subunit_to_unit: 1000,
thousands_separator: ",",
decimal_mark: ".",
iso_numeric: "414",
smallest_denomination: 5
}
However, when I use humanized_money_with_symbol @money_object
it always shows the price with "KWD"
Is there a way to force it to use alternate_symbols
when the locale is Arabic?
not that I can think of at this time. we would welcome a PR to enhance this.
Quick solve:
include "translate" in default_format
:
config.default_format = {
...
translate: true
}
add the currencies to the translation files:
number:
currency:
symbol:
KWD: KWD
USD: USD
now calling humanized_money_with_symbol money_object
will do the work