I am using Rails 4
I have set the default locale to is in config/application.rb
is.yml is in config/locales
In Rails console I type
I18n.availa
1.250
is exactly what you should get with your settings. To get 1,25
this will work.
format:
delimiter: ! ','
precision: 2
separator: ','
significant: false
strip_insignificant_zeros: false
You can create your default configuration of delimiter on locale. Like:
en:
format:
number:
delimiter: ','
pt-BR:
format:
number:
delimiter: '.'
After you set up this. You can call locale on normal delimiter like:
for pt-BR:
number_with_precision(6419336, precision: 2, delimiter:
I18n.t('number.format.delimiter')) #=> "6,419,336.00"
for en:
number_with_precision(6419336, precision: 2, delimiter:
I18n.t('number.format.delimiter')) #=> "6.419.336,00"