3

I'm on Rails 4, and I'm following how to use rails i18n fallback features

My website only has 2 lang, zh, and en, and I want other language such as de, fr fallback to en, so I set as suggested above:

 config.i18n.fallbacks =[:en]

But when I visiting http://localhost:3000/?locale=de it still reports "de" is not a valid locale. (locale for en and zh works fine)

How can I fix this?

UPDATE: this is how I receive locale

  def set_locale
    I18n.locale = params[:locale] || I18n.default_locale
  end
Community
  • 1
  • 1
ZK Zhao
  • 19,885
  • 47
  • 132
  • 206

1 Answers1

2

Add this to your config/application.rb

I18n.config.enforce_available_locales = false
Robert Falkén
  • 2,287
  • 2
  • 16
  • 16