This is the changelog for Cldr v2.7.0 released on April 22nd, 2019. For older changelogs please consult the release tag on GitHub
- Updates to CLDR version 35.1.0 which is primarily related to the change of Japanese era with the ascension of a new emporer on April 1st.
This is the changelog for Cldr v2.6.2 released on April 16th, 2019. For older changelogs please consult the release tag on GitHub
-
Adds
Cldr.flag/1
that returns a binary unicode grapheme representing a flag for a given territory -
The parameters provided to
Cldr.Plug.SetLocale.init/1
are now conformed more precisely based upon the provided options. This ensures that the keys:cldr
and:gettext
are set from other options if they are not provided directly.
Cldr.Plug.SetLocale.init/1
would raise an exception if no:gettext
key was specified. This is now corrected.
This is the changelog for Cldr v2.6.1 released on April 13th, 2019. For older changelogs please consult the release tag on GitHub
-
Correctly resolves the
:data_dir
param for a backend module. Thanks to @erikreedstrom for the report. Closes #123. -
Raises if a backend module configures an
:otp_app
that is not known
This is the changelog for Cldr v2.6.0 released on March 28th, 2019. For older changelogs please consult the release tag on GitHub
- Updates to CLDR version 35.0.0 released on March 27th 2019.
There is one unresolved issue in this implementation related to plural rules for the locale "kw" (Cornish).
The plural rule definition for :other
in the repository is:
"pluralRule-count-other": " @integer 4~19, 100, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.0 100000.0 1000000.0, …",
However in rules testing, the values 1000.0
, 10000.0
and 100000.0
are resolving to category :two
rather than :other
. Until this is resolved, these data points are removed from the test data.
This is the changelog for Cldr v2.5.0 released on March 23rd, 2019. For older changelogs please consult the release tag on GitHub
-
Adds the global
:ex_cldr
configuration key:default_backend
. -
Adds
Cldr.default_backend/0
which will return the configured default backend or will raise an exception if not is configured. -
Where appropriate,
Cldr.*
will now useCldr.default_backend()
as a default parameter.
This is the changelog for Cldr v2.4.3 released on March 20th, 2019. For older changelogs please consult the release tag on GitHub
- Fix
Cldr.validate_locale/1
@spec error and remove spurious@dialyzer
directives
This is the changelog for Cldr v2.4.2 released on March 15th, 2019. For older changelogs please consult the release tag on GitHub
- Exclude
Cldr.Currency
from the list of known providers so that it won't be compiled twice when working withex_cldr_numbers
.
This is the changelog for Cldr v2.4.1 released on March 14th, 2019. For older changelogs please consult the release tag on GitHub
- Makes generation of documentation for backend modules optional. This is implemented by the
:generate_docs
option to the backend configuration. The default istrue
. For example:
defmodule MyApp.Cldr do
use Cldr,
default_locale: "en-001",
locales: ["en", "ja"],
gettext: MyApp.Gettext,
generate_docs: false
end
This is the changelog for Cldr v2.4.0 released on March 10th, 2019. For older changelogs please consult the release tag on GitHub
-
Minor restructuring of the locale files. Calendar map keys are harmonised to have the same names and meanings. This would not normally be user visible but a change in data format suggests a minor version bump to easy version management.
-
Restructure the data returned by
Cldr.Config.week_info/0
to also encode week days as numbers in the range 1..7 where 1 is Monday.
This is the changelog for Cldr v2.3.2 released on March 8th, 2019. For older changelogs please consult the release tag on GitHub
-
Does a better job of detecting a required JSON library and raising at compile time if no such library can be found. In order of priority the search for a JSON library is:
- the key
:json_library
under the application key:ex_cldr
- a configured Phoenix
json_library
- a configured Ecto
json_library
Jason
if configuredPoison
if configured
- the key
This is the changelog for Cldr v2.3.1 released on March 6th, 2019. For older changelogs please consult the release tag on GitHub
- Fix dialyzer errors. In some cases, notably related to
nimble_parsec
, errors are generated that need to be fixed in a dependency. These errors are added to the.dialyzer_ignore_warnings
file for now.
This is the changelog for Cldr v2.3.0 released on March 4th, 2019. For older changelogs please consult the release tag on GitHub
- Adds
Cldr.LanguageTag.to_string/1
which converts aCldr.LanguageTag{}
into a language tag string. This is useful when creating a collator that is based uponlibicu
since that collator will apply the configuration specified by theu
extension in the language tag. For example:
iex> {:ok, locale} = Cldr.validate_locale "en-US-u-co-phonebk-nu-arab", MyApp.Cldr
iex> Cldr.LanguageTag.to_string(locale)
"en-Latn-US-u-ca-phonebk-nu-arab"
- Fix a bug when parsing some locale strings which have extensions. An extension may have a list of "keyword-type" pairs or simply "keyword". Parsing was failing when only the "keyword" form was used. For example the following used to fail, but is now parsed correctly:
iex> {:ok, locale} = Cldr.validate_locale "en-US-u-co-ca", MyApp.Cldr
{:ok,
%Cldr.LanguageTag{
canonical_locale_name: "en-Latn-US",
cldr_locale_name: "en",
extensions: %{},
gettext_locale_name: nil,
language: "en",
language_subtags: [],
language_variant: nil,
locale: %{calendar: "gregory", collation: "standard"},
private_use: [],
rbnf_locale_name: "en",
requested_locale_name: "en-US",
script: "Latn",
territory: "US",
transform: %{}
}}
- Fix a race condition when starting up the compile-time locale cache
This is the changelog for Cldr v2.2.7 released on February 23rd, 2019. For older changelogs please consult the release tag on GitHub
Correctly validates locales that are not pre-compiled into a backend. At compile time, all configured locales are generated from the CLDR data. However not all valid locales can be predefined - especially those that have variants, subtags or extensions or use a different casing to the canonical form.
For example, the following would fail in prior releases even though it is perfectly valid since language tags are defined to be case insensitive:
iex> MyApp.Cldr.validate_locale "en-au"
{:error, {Cldr.UnknownLocaleError, "The locale \"en-au\" is not known."}}
Similarly, it is expected that both the POSIX and IEEE formats of a language tag are acceptable, meaning that a -
or _
should be acceptable. Again, in prior releases this would result in an error:
iex> MyApp.Cldr.validate_locale "en_AU"
{:error, {Cldr.UnknownLocaleError, "The locale \"en_AU\" is not known."}}
Lastly, when using locale extensions, subtags or variants the validation would fail:
MyApp.Cldr.validate_locale "en-u-ca-buddhist"
{:error, {Cldr.UnknownLocaleError, "The locale \"en_AU\" is not known."}}
Each of these examples now correctly validates:
iex> TestBackend.Cldr.validate_locale "en-au"
{:ok,
%Cldr.LanguageTag{
canonical_locale_name: "en-Latn-AU",
cldr_locale_name: "en-AU",
extensions: %{},
gettext_locale_name: "en",
language: "en",
language_subtags: [],
language_variant: nil,
locale: %{},
private_use: [],
rbnf_locale_name: "en",
requested_locale_name: "en-AU",
script: "Latn",
territory: "AU",
transform: %{}
}}
iex> TestBackend.Cldr.validate_locale "en_au"
{:ok,
%Cldr.LanguageTag{
canonical_locale_name: "en-Latn-AU",
cldr_locale_name: "en-AU",
extensions: %{},
gettext_locale_name: "en",
language: "en",
language_subtags: [],
language_variant: nil,
locale: %{},
private_use: [],
rbnf_locale_name: "en",
requested_locale_name: "en-AU",
script: "Latn",
territory: "AU",
transform: %{}
}}
iex> TestBackend.Cldr.validate_locale "en-u-ca-buddhist"
{:ok,
%Cldr.LanguageTag{
canonical_locale_name: "en-Latn-US",
cldr_locale_name: "en",
extensions: %{},
gettext_locale_name: "en",
language: "en",
language_subtags: [],
language_variant: nil,
locale: %{calendar: :buddhist},
private_use: [],
rbnf_locale_name: "en",
requested_locale_name: "en",
script: "Latn",
territory: "US",
transform: %{}
}}
This is the changelog for Cldr v2.2.6 released on February 23rd, 2019. For older changelogs please consult the release tag on GitHub
- Adds
Cldr.Config.territory_currency_data/0
that maps a territory code (like "US") to a list of currencies reflecting the historic and current usage of currencies in that territory.
This is the changelog for Cldr v2.2.5 released on February 18th, 2019. For older changelogs please consult the release tag on GitHub
-
Remove most dialyzer errors
-
Fix documentation syntax errors
-
Fix regex for parsing currency names into currency strings
This is the changelog for Cldr v2.2.4 released on February 10th, 2019. For older changelogs please consult the release tag on GitHub
- Ensure the global default locale (currently "en-001") is always configured
- Log a warning if a CLDR provider module could not be found
This is the changelog for Cldr v2.2.3 released on February 9th, 2019. For older changelogs please consult the release tag on GitHub
- Fix parsing of currency names that have date ranges or annotations within them like "US dollar (next day)" and "Afghan afghani (1927–2002)"
This is the changelog for Cldr v2.2.2 released on February 9th, 2019. For older changelogs please consult the release tag on GitHub
- add
Cldr.Config.currencies_for/2
to return a map of the currency definition for a locale
This is the changelog for Cldr v2.2.1 released on January 30th, 2019. For older changelogs please consult the release tag on GitHub
- Correctly add the
gettext
locale to the language tag returned by<backend>.default_locale
andCldr.default_locale/2
. Thanks to @erikreedstrom. Closes #106.
- Added a section on migrating from
Cldr
1.x to 2.x.
This is the changelog for Cldr v2.2.0 released on December 23nd, 2018. For older changelogs please consult the release tag on GitHub
-
Bump
nimble_parsec
to version 0.5 which has some breaking changes from 0.4 that affects the language tag parser. -
Use
IO.warn/1
for compiler warnings related to global configuration and Cldr providers configuration for a backend.
This is the changelog for Cldr v2.1.0 released on December 1st, 2018. For older changelogs please consult the release tag on GitHub
- Don't issue a bogus global config deprecation warning.
- Revises the Cldr provider strategy - again. Rather than try to auto-discover available provider modules and configuring them automatically they are now configured under the
:provider
key. The readme contains further information on configuring providers. For example:
defmodule MyApp.Cldr do
use Cldr,
locales: ["en", "zh"],
default_locale: "en",
providers: [Cldr.Number, Cldr.List]
end
The default behaviour is the same as Cldr 2.0
in that all known cldr providers are configured.
This is the changelog for Cldr v2.0.4 released on November 26th, 2018. For older changelogs please consult the release tag on GitHub
- Dependency plugin check was using
Mix.Project.in_project/3
which actually changes directory which during compilation is a bad thing (since compilation is in parallel and within a single Unix process). The plugin dependency list is now static. Thanks to @robotvert. Closes #93.
This is the changelog for Cldr v2.0.3 released on November 25th, 2018. For older changelogs please consult the release tag on GitHub
- Check for a
json
library existence as early as possible in the compile cycle since it is required during compilation ofCldr
.
This is the changelog for Cldr v2.0.2 released on November 24th, 2018. For older changelogs please consult the release tag on GitHub
- Move minimal Decimal version to 1.5
Cldr.Substitution.substitute/2
now conforms to its documentation and substitutes a list of terms into a list format
This is the changelog for Cldr v2.0.1 released on November 22, 2018. For older changelogs please consult the release tag on GitHub
- Fixes a bug whereby a backend configured with locales, but no default locale (and no global configuration), would crash during compilation
This is the changelog for Cldr v2.0.0 released on November 22, 2018. For older changelogs please consult the release tag on GitHub
See also Breaking Changes below.
- Transforms the regex's for currency spacing to be compatible with the elixir regex engine. This supports improved conformance for currency formatting in ex_cldr_numbers
- Removes the need for Phoenix as a dependency in tests. Thanks to @lostkobrakai. Closes #84.
- Print deprecation message if the global config is used for more than :json_library and :default_locale
- Align
Cldr/get_locale/1/0
andCldr.put_locale/2/1
with Gettext. SeeCldr.get_locale/1
,Cldr.get_locale/0
,Cldr.put_locale/2
andCldr.put_locale/1
- Improve performance of
Cldr.Gettext.Plural
and align its return better withGettext
- Add the 'miscellaneous' number formats to the locale definition files. This allows formatting of "at least", "approximately", "at most" and "range". These formats will be used in ex_cldr_numbers.
Version 2.0 of Cldr is focused on re-architecting the module structure to more closely follow the model set by Phoenix, Ecto, Gettext and others that also rely on generating a public API at compile time. In Cldr version 1.x, the compile functions were all hosted within the ex_cldr
package itself which has created several challenges:
- Only one configuration was possible per installation
- Dependency compilation order couldn't be determined which meant that when Gettext was configured a second, forced, compilation phase was required whenever the configuration changed
- Code in the ex_cldr _build directory would be modified when the configuration changed
In line with the recommended strategy for configurable library applications, Cldr
now requires a backend module be defined that hosts the configuration and public API. This is similar to the strategy used by Gettext
, Ecto
, Phoenix
and others. These backend modules are defined like this:
defmodule MyApp.Cldr do
use Cldr, locales: ["en", "zh"]
end
For further information on configuration, consult the readme.
Although the api structure is the same in both releases, the move to a backend module hosting configuration and the public API requires changes in applications using Cldr version 1.x. The steps to migrate are:
- Change the dependency in
mix.exs
to{:ex_cldr, "~> 2.0"}
- Define a backend module to host the configuration and public API. It is recommended that the module be named
MyApp.Cldr
since this will ease migration through module aliasing. - Change calls to
Cldr.function_name
toMyApp.Cldr.function_name
. The easiest way to do this is to alias the backend module. For example:
defmodule MyApp.SomeModule do
# alias the backend module so that calls to Cldr functions still work
alias MyApp.Cldr
def some_function do
IO.puts Cldr.known_locale_names
end
end
- Configuration has changed to focus on the backend module, then otp app, then global config. All applications are required to define a backend module.
- The Public API moves to a configured backend module. Functions previous called on
Cldr
should be called onMyApp.Cldr
. - The
~L
sigil has been removed. The public api functions support either a locale name (like "en") or a language tag. Cldr.Plug.AcceptLanguage
andCldr.Plug.SetLocale
need to have a config key :cldr to specify theCldr
backend to be used.- The
Mix
compiler:cldr
is obsolete. It still exists so configuration doesn't break but its no a:noop
. It should be removed from your configuration. Cldr.Config.get_locale/1
now takes aconfig
orbackend
parameter and has becomeCldr.Config.get_locale/2
.Cldr.get_current_locale/0
is renamed toCldr.get_locale/0
to better align withGettext
Cldr.put_current_locale/1
is renamed toCldr.put_locale/1
to better align withGettext