Question

for example Rails will treat :'zh-CN' as :zh

in config/application.rb

config.i18n.fallbacks = [:'zh-CN'] # or ['zh-CN'.to_sym]

ActionView::Helpers::FormBuilder#label will raise

:zh is not a valid locale

I am using Rails 4.1.0.rc1, Ruby 2.1.1 and keep gems latest.

Was it helpful?

Solution

solved by I18n.config.enforce_available_locales = false , then I18n will not try :language locale.

OTHER TIPS

You can set available_locales. Setting enforce_available_locales to false you are turning off the errors instead of adding your language to available_locales.

If you need language zh to be available, just add it to available_locales.

Example:

config.i18n.available_locales = [:"zh-CN", :zh]

try this

config.i18n.fallbacks = [:"zh-CN"]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top