Created
April 18, 2010 09:03
-
-
Save svenfuchs/370118 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Allows to configure locale fallbacks through config.i18n.fallbacks. The default setting config.i18n.fallbacks = true in production.rb will make I18n.t lookup fall back to the I18n.default_locale if a translation could not be found for the current or given locale. | |
# USAGE | |
# do nothing in config (i.e. remove the line in environment/production.rb) | |
# => local fallbacks won't be used | |
# set to true | |
config.fallbacks = true | |
# => uses I18n::Fallbacks.new | |
# always falls back to the I18n.default_locale | |
# use the OrderedOptions | |
config.fallbacks.map = { :ca => :es } | |
config.fallbacks.defaults = [:'es-ES', :es] | |
# => uses I18n::Fallbacks.new(:'es-ES', :es, :ca => :es), see below | |
# SHORTCUTS | |
# set to an Array of defaults | |
config.fallbacks = [:'es-ES', :es] | |
# => uses I18n::Fallbacks.new(:'es-ES', :es) | |
# always finally falls back to the I18n.default_locale, additionally always falls back through es-ES and es | |
# set to a Hash of mappings | |
config.fallbacks = { :ca => :es } | |
# => uses I18n::Fallbacks.new(:'es-ES', :es) | |
# always finally falls back to the I18n.default_locale, additionally falls back from cs to es | |
# default Array and mappings Hash can be mixed | |
config.fallbacks = [:'es-ES', :es, { :ca => :es }] | |
# => uses I18n::Fallbacks.new(:'es-ES', :es, :ca => :es) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment