class I18n::Locale::Fallbacks

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.cr

Constructors

Instance Method Summary

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 default : Array(String) #

def for(locale : String | Symbol) : Array(String) #

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


def mapping : Hash(String, Array(String)) #