polyglot v0.0.1 Polyglot.Locale

Internal helpers to work with locale identifiers.

Summary

Functions

Returns true if the locale looks like it is the subtype of another locale. Does not check if the parent locale actually exists

Returns the parent locale for the specified locale by stripping of one trailing subtype and underscore. Returns nil if there is no parent locale to be extracted from the locale. Does not check if the parent locale actually exists

Functions

has_parent?(locale)

Returns true if the locale looks like it is the subtype of another locale. Does not check if the parent locale actually exists.

Examples

iex> Polyglot.Locale.has_parent?(:fr)
false

iex> Polyglot.Locale.has_parent?(:de_AT)
true
parent(locale)

Returns the parent locale for the specified locale by stripping of one trailing subtype and underscore. Returns nil if there is no parent locale to be extracted from the locale. Does not check if the parent locale actually exists.

Examples

iex> Polyglot.Locale.parent(:fr)
nil

iex> Polyglot.Locale.parent(:de_AT)
:de

iex> Polyglot.Locale.parent(:en_US_POSIX)
:en_US