View Source Cldr.LanguageTag.Sigil (Cldr v2.40.0)
Implements a sigil_l/2
macro to
constructing t:Cldr.LanguageTag
structs.
Summary
Functions
Handles sigil ~l
for language tags.
Functions
Handles sigil ~l
for language tags.
Arguments
locale_name
is either a BCP 47 locale name as a string orlocale_name
|backend
where backend is a backend module name.
Options
u
Will parse the locale but will not add likely subtags and its not guaranteed that this language tag is known to the backend module.
Returns
a
Cldr.LanguageTag.t/0
struct orraises an exception.
Examples
iex> import Cldr.LanguageTag.Sigil
iex> inspect(~l(en-US-u-ca-gregory))
"TestBackend.Cldr.Locale.new!(\"en-US-u-ca-gregory\")"
iex> import Cldr.LanguageTag.Sigil
iex> inspect(~l(en-US-u-ca-gregory|MyApp.Cldr))
"MyApp.Cldr.Locale.new!(\"en-US-u-ca-gregory\")"
iex> import Cldr.LanguageTag.Sigil
iex> inspect(~l(en))
"TestBackend.Cldr.Locale.new!(\"en-US\")"
iex> import Cldr.LanguageTag.Sigil
iex> inspect(~l(en)u)
"TestBackend.Cldr.Locale.new!(\"en\")"