Icu (icu v0.4.0)
High-level entry point for Icu, exposing ICU4X-powered internationalisation helpers to Elixir.
Most functionality is provided by specialised formatter modules:
Icu.LanguageTag- locale parsing and inspection.Icu.Numberand - locale-aware number and formatting.Icu.List- conjunction-aware list formatting across locales.Icu.Temporalfor locale-aware formatting of instants in time. SupportsTime,DateTime,NaiveDateTime,Date.Icu.RelativeTime- for locale-aware relative time formatting.
Use these modules directly to construct formatters and render values.
Locale data
Many functions in this library relies on data from unicode CLDR to work.
This library ships with data for all locales with coverage levels
basic, moderate or modern in
https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/coverageLevels.json
Summary
Functions
Gets the current locale.
Functions
@spec get_locale() :: Icu.LanguageTag.t()
Gets the current locale.
Will resolve to, in order:
- Get the locale for the current process
- Get the configured default locale
@spec put_locale(Icu.LanguageTag.parsable()) :: :ok | Icu.LanguageTag.parse_error()
@spec with_locale(Icu.LanguageTag.parsable(), (-> result)) :: result | Icu.LanguageTag.parse_error() when result: var