How do I set the default locale in rails application.rb so I don't have to add unit every time I call the following?
number_to_currency(@course.price, unit: "£")
Rails guides says my locale is :en-GB
for the UK, but the following obviously creates an error in application.rb
config.i18n.default_locale = :en-GB
The rails-i18n
gem contains a lot of locale configurations for Rails and en-GB is one of them. en-GB isn't included in Rails itself.
rails-i18n
gemconfig.i18n.default_locale = :'en-GB'
to application.rb
Try this:
config.i18n.default_locale = :'en-GB'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With