Cldr.Locale.parent
You're seeing just the function
parent
, go back to Cldr.Locale module for more information.
Specs
parent(Cldr.LanguageTag.t()) :: {:ok, Cldr.LanguageTag.t()} | {:error, {module(), binary()}}
Returns the parent for a given locale.
The function implements locale inheritance in accordance with CLDR's inheritance rules.
Only locales that are configured are returned. That is, there may be a different parent locale in CLDR but unless those locales are configured they are not candidates to be parents in this context. The contract is to return either a known locale or an error.
Inheritance
Inheritance starts by looking for a parent locale via
Cldr.Config.parent_locales/0
.If not found, strip in turn the variant, script and territory while checking to see if a base locale for the given language exists.
If no parent language exists then move to the default locale and its inheritance chain.
Specs
parent(locale_name(), Cldr.backend()) :: {:ok, Cldr.LanguageTag.t()} | {:error, {module(), binary()}}