Skip to content

Localize version 1.6.1

Choose a tag to compare

@kipcole9 kipcole9 released this 02 Nov 09:35
· 18 commits to main since this release

[1.6.1] — November 2nd, 2026

Changed

  • Localize.LanguageTag looks likely subtags up by the {language, script, region} tuple of CLDR's keys and a language alias by the tuple of its parts, and Localize.Collation.Tailoring looks 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/0 lists {cldr_locale_id, type} tuples of atoms, {:"fr-CA", :standard} where it listed {"fr-CA", :standard}.

  • Localize.Collation.Options.from_locale/1 reads 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-digit is [:Latn, :digit] where it was [:latn, :digit], which the NIF backend also accepts. Localize.Collation.compare/3 and sort/2 still collate an invalid locale as root.

Fixed

  • Localize.DateTime.Format.Match.time_preferences_for/1 validates a locale before looking up its hour cycle, and the time-preference data keys fr-CA and its kin by {language, territory} tuples beside the territory atoms, so a default-content locale such as en-US or fr-FR takes its territory's cycle and fr-Latn-CA takes fr-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/1 reads 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/1 matches a binary code against the known codes read first, and territory_currencies/1 and current_currency_for_territory/1 validate a binary territory, rather than match either against the atoms the VM has seen, so "TA" and "ac" answer as :TA and :AC do; on a fresh VM "TA" was an unknown territory and had no currency. Localize.Territory.Subdivision.display_name/2 reads the names before matching the code, for the same reason.

  • Localize.validate_locale/1 and Localize.LanguageTag.U.parse/1 read a -u- keyword with no type as the type true, as TR35 §3.6.4 does, so en-u-kn validates as en-u-kn-true does; it was an invalid locale. A key without a type true, -u-ka, stays invalid.

  • Localize.Unit.Math.sin/1 and the other dimensionless functions, through apply_dimensionless/2, take an angle in radians and a ratio as the plain ratio whatever unit it is written in, so sin of 90 degree is 1.0 and ln of 100 percent is 0.0. They applied the function to the value as written, so sin of 90 degree was the sine of 90 radians, 0.894.

  • The same functions return {:error, Localize.InvalidValueError} for a value outside the function's domain, ln of 0 percent or asin of 200 percent, and for a result too large for a float; they raised ArithmeticError out of :math.