class I18n::Locale::Fallbacks
- I18n::Locale::Fallbacks
- Reference
- Object
Overview
A locales fallbacks configuration.
This class allows to configure locales fallbacks. Locales fallbacks are comprised of a mapping of fallback chains (where specific locales are associated with a specific fallback configuration) and a default fallback chain (which is used when no fallback configurations are associated with specific locales).
I18n.config.fallbacks = I18n::Locale::Fallbacks.new(
{"fr-CA-special": ["fr-CA", "fr", "en"]},
default: ["en"]
)
Defined in:
i18n/locale/fallbacks.crConstructors
Instance Method Summary
- #default : Array(String)
-
#for(locale : String | Symbol) : Array(String)
Returns the locales that should be used as fallbacks for a given locale.
- #mapping : Hash(String, Array(String))
Constructor Detail
def self.new(mapping : Hash(String | Symbol, Array(String | Symbol) | String | Symbol) | NamedTuple | Nil = nil, default : Array(String | Symbol) | Nil = nil)
#
Instance Method Detail
def for(locale : String | Symbol) : Array(String)
#
Returns the locales that should be used as fallbacks for a given locale.