Repository navigation
Localize version 1.6.1
[1.6.1] — November 2nd, 2026
Changed
-
Localize.LanguageTaglooks likely subtags up by the{language, script, region}tuple of CLDR's keys and a language alias by the tuple of its parts, andLocalize.Collation.Tailoringlooks a tailoring up by the CLDR locale a validated tag carries and then by its parents', so none builds a locale identifier from a tag's parts.Localize.Collation.Tailoring.supported_locales/0lists{cldr_locale_id, type}tuples of atoms,{:"fr-CA", :standard}where it listed{"fr-CA", :standard}. -
Localize.Collation.Options.from_locale/1reads its options from the validated tag's-u-extension rather than parsing the locale's text itself, so a locale that does not validate — an unknown keyword or value — returns{:error, exception}where it took a default, and-u-kr-latn-digitis[:Latn, :digit]where it was[:latn, :digit], which the NIF backend also accepts.Localize.Collation.compare/3andsort/2still collate an invalid locale as root.
Fixed
-
Localize.DateTime.Format.Match.time_preferences_for/1validates a locale before looking up its hour cycle, and the time-preference data keysfr-CAand its kin by{language, territory}tuples beside the territory atoms, so a default-content locale such asen-USorfr-FRtakes its territory's cycle andfr-Latn-CAtakesfr-CA's. It answered the world's 24-hour cycle for any locale whose atom the VM had not yet seen, so"en-US"was 24-hour until something else named:"en-US"; closes #70. -
Localize.validate_measurement_system/1reads the systems and their aliases before matching a binary against them, so"ussystem"and"imperial"validate on a fresh VM; they were refused until something else had loaded the data. -
Localize.Currency.validate_currency/1matches a binary code against the known codes read first, andterritory_currencies/1andcurrent_currency_for_territory/1validate a binary territory, rather than match either against the atoms the VM has seen, so"TA"and"ac"answer as:TAand:ACdo; on a fresh VM"TA"was an unknown territory and had no currency.Localize.Territory.Subdivision.display_name/2reads the names before matching the code, for the same reason. -
Localize.validate_locale/1andLocalize.LanguageTag.U.parse/1read a-u-keyword with no type as the typetrue, as TR35 §3.6.4 does, soen-u-knvalidates asen-u-kn-truedoes; it was an invalid locale. A key without a typetrue,-u-ka, stays invalid. -
Localize.Unit.Math.sin/1and the other dimensionless functions, throughapply_dimensionless/2, take an angle in radians and a ratio as the plain ratio whatever unit it is written in, sosinof90 degreeis1.0andlnof100 percentis0.0. They applied the function to the value as written, sosinof90 degreewas the sine of 90 radians,0.894. -
The same functions return
{:error, Localize.InvalidValueError}for a value outside the function's domain,lnof0 percentorasinof200 percent, and for a result too large for a float; they raisedArithmeticErrorout of:math.