What is the correct way to handle geographic locations in Ruby on Rails?

I am surprised to see that i18n Ruby on Rails does not support local networks such as en-GB, en-US, en-AU, etc. Looking back, it seems that the task is left to third-party libraries and code. I searched and found rails-i18n-translation-inheritance-helper , but it does not seem active. Does anyone localize their Rails applications or is there another solution that I am missing?

+5
source share
1 answer

You can set the current locale to whatever you want using something like

I18n.locale = 'en_US'

, i18n :

config.i18n.default_locale = 'en'
config.i18n.fallbacks = {
  'en_US' => 'en',
  'en_GB' => 'en',
  'de_DE' => 'de',
  'de'    => 'en'
}

, , i18n .

+8

All Articles