class

I18n::Locale::Fallbacks

Inherits Reference / Object

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"]
)

Constructors

new(mapping : Hash(String | Symbol, Array(String | Symbol) | String | Symbol) | NamedTuple | Nil = nil, default : Array(String | Symbol) | Nil = nil)
Source

Instance methods

default
Source
for(locale : String | Symbol) : Array(String)

Returns the locales that should be used as fallbacks for a given locale.

Source
mapping
Source