Skip to content

Releases: elixir-cldr/cldr

Cldr version 2.22.1

20 May 11:39
Compare
Choose a tag to compare

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 a t:Cldr.LanguageTag

  • Cldr.validate_locale/1 doesn't raise if there is no default backend configured and the locale is a t:Cldr.LanguageTag

Cldr version 2.22.0

20 May 00:54
Compare
Choose a tag to compare

Soft deprecation

  • The plug Cldr.Plug.SetSession was introduced in ex_cldr version 2.21.0. However the convention in Phoenix and Plug is put, not set. The plug is renamed to Cldr.Plug.PutSession. Cldr.Plug.SetSession is still available but will emit a deprecation notice and will delegatge to Cldr.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

17 May 01:28
Compare
Choose a tag to compare

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 and 1 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 to mix 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 to Cldr.Plug.SetLocale is deprecated. A well-known session key is required in order to support setting the locale from the session passed to mount/3 for liveview applications. The session key is available as Cldr.Plug.SetLocale.session_key/0

  • Adds Cldr.Plug.SetSession that will copy the cldr locale name from the conn 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

07 Apr 22:26
Compare
Choose a tag to compare

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 the root locale. It is a recursive use of Cldr.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. When true, the fallback locales of the configured backend locales is also added to the configuration. The default is false and therefore by default there is no change to behaviour from previous releases. Setting this option to true 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 the root locale.

  • Add Cldr.Config.fallback/1 which takes a locale name and returns the direct parent of the locale name.

  • Rename alias key subdivisionAlias to subdivision

  • 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

07 Apr 08:33
Compare
Choose a tag to compare
Pre-release

Bug Fixes

Cldr version 2.19.1

07 Apr 08:33
Compare
Choose a tag to compare

Bug Fixes

Cldr version 2.20.0-rc.2

22 Mar 21:19
Compare
Choose a tag to compare
Pre-release

Enhancements

  • Add :add_fallback_locales to the backend configuration. When true, the fallback locales of the configured backend locales is also added to the configuration. The default is false and therefore by default there is no change to behaviour from previous releases. Setting this option to true 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 the root locale.

  • Add Cldr.Config.fallback/1 which takes a locale name and returns the direct parent of the locale name.

  • Rename alias key subdivisionAlias to subdivision

Cldr version 2.20.0-rc.1

22 Mar 00:34
Compare
Choose a tag to compare
Pre-release

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

19 Mar 00:24
Compare
Choose a tag to compare
Pre-release

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 the root locale. It is a recursive use of Cldr.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

10 Feb 17:21
Compare
Choose a tag to compare

Breaking change

  • A parsed langauge tag would previously turn the tz parameter of the u extension into a timezone ID. For example, the language tag en-AU-u-tz-ausyd would decode ausyd into Australia/Sydney. From this release, parsing no longer decodes the tz parameter since doing so means that to_string/1 does not work correctly. Use Cldr.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 to Cldr.ellipsis/2. This option is either :word or :sentence. :sentence is the default. Using the locale en 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"