Skip to content

Localize version 1.2.0

Latest

Choose a tag to compare

@kipcole9 kipcole9 released this 16 Aug 12:41
· 18 commits to main since this release

[1.2.0] — August 16th, 2026

Changed

  • Breaking. Localize.Number.Parser.scan/2 now treats a space as a grouping separator in locales that group with one, so runs of digits that it previously returned separately can come back as a single number. Under fr, "chambres 12 14 16" was ["chambres ", 12, " ", 14, " ", 16] and is now ["chambres ", 121416]; pass lenient: false to require exact grouping sizes and get the old result. This is what lets "1 234,5" be found as one number, which is the point of the change.

  • Breaking. Localize.Number.parse/2 and scan/2 validate that grouping separators sit in plausible positions, matching ICU, so input that was previously accepted can now fail. Under fr, parse("3 4") was {:ok, 34} and is now an error, because a single digit is not a group in any locale.

  • Localize.Number.parse/2 and Localize.Number.Parser.scan/2 take a :lenient option governing that validation. true, the default, requires each group to be at least two digits, which is ICU's lenient rule; false requires exactly the locale's grouping size — three for most locales, and the 3-then-2 of en-IN.

Fixed

  • Localize.Number.Parser.scan/2 finds a grouped number written with an ordinary keyboard space in a locale that formats with U+202F. Under fr, scan("1 234,5") was [1, " ", 234.5] and is now [1234.5].

  • Localize.Number.parse/2 treats every character in [:Zs:] as a grouping space, per TR35's loose matching for lenient parsing. It previously accepted only U+0020 and the locale's own separator, so a fr number carrying U+00A0 or U+2009 — as copied out of formatted output — failed to parse.

  • Localize.Number.parse/2 ignores every character in [:Cf:], per the same passage's instruction to ignore format characters, "in particular ... any RLM, LRM or ALM used to control BIDI formatting". CLDR writes the minus sign of ar, he, fa and 16 other locales as a BIDI mark followed by the sign, so a negative number copied out of that text previously failed to parse.

  • Localize.Number.parse/2 applies CLDR's parseLenients character folds, which were generated into the locale data but never read. The minus, plus, comma and full-stop families now fold to their canonical form, so the 18 locales writing minusSign as U+2212 — fa, fi, sv and no among them — parse their own negative numbers back. Per TR35 the fold applies to the locale's own separators as well as the input, which is what lets de-CH accept both spellings of its apostrophe group separator.