Releases: elixir-cldr/cldr
Cldr version 2.22.1
Bug Fixes
-
Cldr.Number.PluralRule.plural_type/2
correcly returns a plural type when no backend is provided, no default backend is configured and the locale is at:Cldr.LanguageTag
-
Cldr.validate_locale/1
doesn't raise if there is no default backend configured and the locale is at:Cldr.LanguageTag
Cldr version 2.22.0
Soft deprecation
- The plug
Cldr.Plug.SetSession
was introduced inex_cldr
version 2.21.0. However the convention in Phoenix and Plug isput
, notset
. The plug is renamed toCldr.Plug.PutSession
.Cldr.Plug.SetSession
is still available but will emit a deprecation notice and will delegatge toCldr.Plug.PutSession.
Apologies to all for the sloppy release review process.
Bug Fixes
- Fix typespec of Cldr.AcceptLanguage.best_match/2. Thanks to @adriankumpf.
Enhancements
- Make log level for "no match" errors in
Cldr.Plug.AcceptLanguage
configurable.
Cldr version 2.21.0
Bug Fixes
-
Correctly pluralize numbers where the plural rule has an explicit case for the given number. When pluralizing numbers, plural rules will return a value such as
:one
,:two
,:few
,:many
which is used as a key into a map of substitutions. However it is also possible to have substitutions based upon the explicit value of a number, rather than its plural type. Previously this last rule was not being applied but now is. For the purposes of pluralization,1.0
and1
are considered the same - plural rules use the integer representation so a float is cast to an integer when they are both equal according to==
. -
Correctly pluralize Decimal numbers (in addition to integer and float)
Enhancements
-
Add
--force-locale-download
option tomix cldr.install.locales
. -
Plug.SetLocale
default keys for locale discovery from an HTTP request are now expanded to be[:session, :accept_language, :query, :path]
. -
The
:session_key
option toCldr.Plug.SetLocale
is deprecated. A well-known session key is required in order to support setting the locale from the session passed tomount/3
for liveview applications. The session key is available asCldr.Plug.SetLocale.session_key/0
-
Adds
Cldr.Plug.SetSession
that will copy the cldr locale name from theconn
and put it in the session. This simplifies the lifecycle of a typical HTTP request and ensures that the locale is readily available in liveviews as well.
Cldr version 2.20.0
Enhancements
-
Updates to CLDR version 39 data.
-
Add
Cldr.Locale.parent/1
to return the parent locale according. This is not exactly the same as the CLDR locale inheritance rules -
Add
Cldr.Locale.parents/2
to return a list of parents up to and including theroot
locale. It is a recursive use ofCldr.Locale.parent/1
. -
Add locale display name data to the locale files. This data can be used to format a locale for UI usage.
-
Add subdivision translations to the locale files. This data can be used to format subdivision names for UI usage. Thanks to @mskv. Closes #144.
-
Add grammatical features to the repository. This data is used in ex_cldr_units. See also
Cldr.Config.grammatical_features/0
. -
Add grammatical gender to the repository. This data is used in ex_cldr_units. See also
Cldr.Config.grammatical_gender/0
. -
Make
Cldr.Locale.first_match/2
a public function. This function is useful for other CLDR-based libraries to help resolve the files of localised content in CLDR. -
Add
:add_fallback_locales
to the backend configuration. Whentrue
, the fallback locales of the configured backend locales is also added to the configuration. The default isfalse
and therefore by default there is no change to behaviour from previous releases. Setting this option totrue
enables means that data that is stored in parent locales rather than child locales can be processed. This applies particularly to rules-based number formats and subdivision data. These data aren't stored in all locales - generally they are stored in the base language locale. -
Add
Cldr.Config.fallback_chain/1
which takes a locale name and returns a list of locales from which this locale inherits up to but not including theroot
locale. -
Add
Cldr.Config.fallback/1
which takes a locale name and returns the direct parent of the locale name. -
Rename alias key
subdivisionAlias
tosubdivision
-
Fix
Cldr.Substitution.substitute/2
when the template has no substitutions. Thanks to @jarrodmoldrich. Closes ex_cldr_units #20.
Cldr version 2.20.0-rc.3
Bug Fixes
- Fix
Cldr.Substitution.substitute/2
when the template has no substitutions. Thanks to @jarrodmoldrich. Closes ex_cldr_units #20.
Cldr version 2.19.1
Bug Fixes
- Fix
Cldr.Substitution.substitute/2
when the template has no substitutions. Thanks to @jarrodmoldrich. Closes ex_cldr_units #20.
Cldr version 2.20.0-rc.2
Enhancements
-
Add
:add_fallback_locales
to the backend configuration. Whentrue
, the fallback locales of the configured backend locales is also added to the configuration. The default isfalse
and therefore by default there is no change to behaviour from previous releases. Setting this option totrue
enables means that data that is stored in parent locales rather than child locales can be processed. This applies particularly to rules-based number formats and subdivision data. These data aren't stored in all locales - generally they are stored in the base language locale. -
Add
Cldr.Config.fallback_chain/1
which takes a locale name and returns a list of locales from which this locale inherits up to but not including theroot
locale. -
Add
Cldr.Config.fallback/1
which takes a locale name and returns the direct parent of the locale name. -
Rename alias key
subdivisionAlias
tosubdivision
Cldr version 2.20.0-rc.1
Enhancements
- Make
Cldr.Locale.first_match/2
a public function. This function is useful for other CLDR-based libraries to help resolve the files of localised content in CLDR.
Cldr version 2.20.0-rc.0
Enhancements
-
Updates to CLDR version 39 data.
-
Add
Cldr.Locale.parent/1
to return the parent locale according. This is not exactly the same as the CLDR locale inheritance rules -
Add
Cldr.Locale.parents/2
to return a list of parents up to and including theroot
locale. It is a recursive use ofCldr.Locale.parent/1
. -
Add locale display name data to the locale files. This data can be used to format a locale for UI usage.
-
Add subdivision translations to the locale files. This data can be used to format subdivision names for UI usage. Thanks to @mskv. Closes #144.
-
Add grammatical features to the repository. This data is used in ex_cldr_units. See also
Cldr.Config.grammatical_features/0
. -
Add grammatical gender to the repository. This data is used in ex_cldr_units. See also
Cldr.Config.grammatical_gender/0
.
Cldr version 2.19.0
Breaking change
- A parsed langauge tag would previously turn the
tz
parameter of theu
extension into a timezone ID. For example, the language tagen-AU-u-tz-ausyd
would decodeausyd
intoAustralia/Sydney
. From this release, parsing no longer decodes thetz
parameter since doing so means thatto_string/1
does not work correctly. UseCldr.Locale.timezone_from_locale/1
instead.
Enhancements
-
Updates to CLDR 38.1
-
Includes the display name and where available the gender for units in the locale data to support generating UI elements in the upcoming version 3.4.0 of ex_cldr_units
-
Add
Cldr.Locale.timezone_from_locale/{1,2}
to extract a timezone ID from a language tag -
Add option
:format
toCldr.ellipsis/2
. This option is either:word
or:sentence
.:sentence
is the default. Using the localeen
as an example, the differences in formatting are:
# Default style: :sentence
iex> Cldr.ellipsis "And furthermore"
"And furthermore…"
iex> Cldr.ellipsis ["And furthermore", "there is much to be done"], locale: "ja"
"And furthermore…there is much to be done"
# With style: :word
iex> Cldr.ellipsis "And furthermore", style: :word
"And furthermore …"
iex> Cldr.ellipsis ["And furthermore", "there is much to be done"], locale: "ja", format: :word
"And furthermore … there is much to be done"