All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.32.0] — May 12th, 2026
Bug Fixes
mix localize.download_localesno longer evaluatesconfig/runtime.exsof the consumer application. Previously the task ranMix.Task.run("app.config"), which transitively evaluatedruntime.exs, which was not necessary. The task now loads only compile-time config (config/config.exsand any imported env-specific file), matching the build-time contract its docstring already advertised. Thanks to @whatyouhide for the PR.Hardened two further sites that pattern-matched
{:ok, _} = <fallible Localize call>and could have surfaced the sameMatchErrorclass as issue #26: the per-unit format loop inLocalize.Duration.to_string/2now short-circuits on the first formatter error, andLocalize.Number.Formatter.Decimal's digit-transliteration step now useswithto fall through to untransliterated digits if either the requested or:latnnumber-system data is unavailable.
Hardening
New
Localize.LintTestsource-level lint that scanslib/and fails the test suite if any file pattern-matches{:ok, _} =against a known-fallible Localize call. The list of fallible calls and an empty allowlist live in the test; future occurrences fail loudly on the offending PR rather than waiting for a runtime regression report.New
Localize.Locale.FallbackResilienceTestexercises the load → store → get pipeline for seven representative regional locales under a provider that only serves:en, asserting that the data ends up under the canonicalised requested key and thatprovider.get/3succeeds.New
Mix.Tasks.Localize.DownloadLocalesTestcallsDownloadLocales.banner/2directly withdefault_locale: :"en-ZA"set, reproducing the exact scenario from issue #26 without invoking the network.banner/2is now@doc falseso the test can reach it.
[0.31.0] — May 12th, 2026
Bug Fixes
Localize.Locale.Loadernow stores fallback locale data under the requested locale id rather than the resolved fallback id, restoring 0.29 behaviour. The regression introduced in 0.30.0 causedprovider.get(requested_locale, _)to miss in-memory fallback data and surface as a spuriousItemNotFoundError— most visibly crashingmix localize.download_localeswith aMatchErrorwhendefault_localenamed an unavailable locale. Locked down withtest/localize/locale/loader_fallback_test.exs. Closes #26.mix localize.download_localesno longer pattern-matches on the result ofLocalize.Message.format/2when building its progress banner; if formatting fails for any reason the task falls back to a plain ASCII banner and continues with the actual download.
Behaviour Changes
Localize.InvalidValueErrorgained an:allowed_valuesfield and a newLocalize.NoCertificateStoreErrorcarries the searched paths; previously prose-stuffed:expected/:currencyfields and bare-string:reasoncodes are now structural.Eight option-validation sites across
Localize.Language,Localize.Script,Localize.Collation,Localize.Utils.Map, andLocalize.Utils.Httpnow raise structured Localize exceptions rather thanArgumentError/RuntimeError.
[0.30.1] — May 12th, 2026
Bug Fixes
- Revert the
[:safe]option on:binary_to_term/2since we cannot guarantee all the required atoms are materialized at application start. Thanks to @bigardone for the report. Closes #25.
[0.30.0] — May 12th, 2026
Security
Localize.LanguageTag.parse/1no longer callsString.to_atom/1on raw parser output, closing an atom-table-exhaustion DOS vector on untrusted locale inputs. Atomisation is now gated behind the CLDR validity sets after alias resolution, and unrecognised language/script/territory subtags returnLocalize.InvalidSubtagError.Localize.Locale.to_locale_id/1renamed toLocalize.Locale.cldr_locale_id_from/1and now returns{:ok, atom()} | {:error, Exception.t()}, gating atom creation behindLocalize.validate_locale/1and closing a second atom-table-exhaustion vector on locale inputs.Localize.Currency.validate_currency/1,territory_currencies/1,current_currency_for_territory/1, and the binary-code branch ofcurrencies_for_locale/3's filter no longer atomise input before checking validity. Unknown currency or territory binaries are rejected viaHelpers.existing_atom/1and never grow the atom table.Localize.Script.display_name/2andLocalize.Unit.Formatterno longer atomise binary input before checking validity. Unknown script codes returnLocalize.UnknownScriptErrorwithout growing the atom table; the unit formatter's currency atomisation is gated as defence-in-depth behind the upstreamLocalize.Unit.validate_currency_codes/1check.MF2
:listfunction and unit parser no longer atomise user-controlled binaries. The:listfunction's binarystyle=fallthrough now sets a sentinel atom that surfaces as anInvalidValueErrorinLocalize.List, and SI prefix names are resolved through a compile-time lookup map (Localize.Unit.Data.si_prefix_atom/1) rather thanString.to_atom/1at parse time.Localize.Number.System(system_name_from/2,number_system_digits/1,to_system/2),Localize.Number.Symbol.number_symbols_for/2, and the datetime-formatter'stime_preferences_for/1no longer atomise user-supplied binary number-system or locale names before validation. Lookups go throughHelpers.existing_atom/1against pre-atomised CLDR data sets.Closed additional Atom DOS vectors in
Localize.Locale.LocaleDisplay.display_name/2(now routes throughcldr_locale_id_from/1),Localize.Territory.Subdivision.display_name/2, the-u-co-and-u-kr-extension parsers inLocalize.Collation.Options, and the redundantString.to_atom(to_string(...))round-trip in plural-rule fallback.Closed three further atom-DOS sites called out by the security audit's findings 1.4 and 1.5:
LocaleDisplay.U.find_exemplar_city/2(-u-tz-IANA region/city splitter),LocaleDisplay.T.to_atom_safe/1(-t-extension subtag normalisation), andGettext.Interpolation.safe_to_atom/1(missing-binding name reporting). All three previously fell through toString.to_atom/1on a miss, which defeated the helper's name; they now return the original binary unchanged when no atom exists.Locale cache files and downloaded ETFs are decoded with
:erlang.binary_to_term(_, [:safe]). Closes a node-crash vector for any deployment with:locale_cache_dirset to a writable directory: a malicious or corrupted cache file can no longer resurrect arbitrary atoms, funs, or refs. Failed safe decodes surface asLocaleNotFoundInCacheError(orLocaleDownloadErrorfor the download path) and the file is treated as stale.Public parser entry points now reject oversized input before invoking the grammar, capping the parser's CPU exposure on hostile input. Defaults are 256 bytes for
Localize.LanguageTag.parse/1andLocalize.Unit.Parser.parse/1, 64 KB forLocalize.Message.Parser.parse/1, and 1 KB forLocalize.Number.Parser.parse/2. Each cap is configurable via app env (:max_locale_id_bytes,:max_message_bytes,:max_unit_bytes,:max_number_bytes).Number.Parser.parse/2additionally rejectsDecimalresults whose exponent magnitude exceeds:max_decimal_exponent(default ±100) so downstream multiplication or formatting cannot materialise huge mantissas.Localize.FormatCacheETS table switched from:publicto:protected; writes are routed through the cache GenServer. The size cap (:format_cache_max_entries, default 2 000) is now enforced synchronously on each insert rather than by a 10-second sweeper, replacing the previous biased-random eviction that could leave the cache oversized. NewLocalize.FormatCache.clear/0andsize/0helpers added for tests and maintenance.NIF (ICU bindings) hardened. All NIF entries except
nif_plural_rulenow run on the dirty CPU scheduler pool (ERL_NIF_DIRTY_JOB_CPU_BOUND); the collator pool is sized forschedulers + dirty_cpu_schedulersandreserve_collrefuses overflow rather than reading past the array end. The reorder-codes branch capsnumCodesat 256 and checksenif_allocbefore use; everystd::stoll/std::stod/std::stoiis wrapped intry/catchso out-of-range C++ exceptions cannot unwind through the NIF boundary; the hand-rolled JSON arg parser guards each access afterskip_ws; per-call input lengths are capped at the NIF boundary (MAX_MF2_BYTES = 64 KB,MAX_COLLATION_BYTES = 1 MB,MAX_NUMBER_STR_BYTES = 1 KB).Localize.Unit.CustomRegistry.load_file/1now refuses to evaluate the file in:prod(or any environment without a loadedMixmodule — typical for releases) unlessconfig :localize, :allow_runtime_unit_files, trueis explicitly set. Outside:prodthe function works as before. The flag exists so an unintended feature switch in production cannot accidentally surface arbitrary code execution viaCode.eval_file/1.:localize_locale_cacheETS table switched from:publicto:protected, owned byLocalize.Locale.Loader. Writes are routed through the owner viacast(so the hot validate path doesn't block and writes triggered from inside the owner's ownhandle_callcannot deadlock). Reads remain direct ETS lookups. Combined with the format cache fix above, both ETS caches are now:protectedagainst multi-tenant or other-library interference.Localize.Utils.Http.get/2andget_with_headers/2now reject responses larger than 50 MB by default (configurable via:max_http_body_bytesapp env or per-call:max_body_bytesoption). Without the cap a malicious or compromised CDN could feed a multi-gigabyte response and OOM the BEAM. Oversized responses log an error and return{:error, :response_too_large}. Additionally, when peer certificate verification has been disabled (viaLOCALIZE_UNSAFE_HTTPS), a one-timeLogger.warningis emitted so a misconfigured production deployment cannot silently downgrade TLS without leaving an audit trail.
[0.29.0] — May 11th, 2026
Behaviour Change
Localize.Currency.currency_for_code/2now returns the newLocalize.CurrencyNotLocalizedError(instead ofUnknownCurrencyError) when the currency code is valid but the locale has no display data for it.UnknownCurrencyErroris now reserved for codes that aren't recognised ISO 4217 or registered custom currencies.
Enhancements
Localize.Currency.currency_for_code/2accepts a new:fallbackoption which walks the CLDR parent locale chain and the application default locale before failing. Thanks to @neilberkman for the PR.Localize.Locale.get/3accepts a new:fallback_to_defaultoption for a final-step fallback after any:fallbackparent walk. Acceptstrue(useLocalize.default_locale/0), or an atom/string/Localize.LanguageTagfor a specific locale.Add
:iso_3166option toLocalize.Territory.territory_codes/1to return only ISO 3166 codes (not aggregate territories).
[0.28.0] — May 9th, 2026
Behaviour Change
Localize.Interval.to_string/3Date intervals (style:date, the default) now resolve their skeleton per-locale instead of using a hard-coded locale-independent mapping. The interval looks upLocalize.DateTime.Format.date_formats(locale_id)[format]— the same mappingLocalize.Date.to_string/2uses — so date intervals follow the same conventions as single dates for the same:format. Visible effect on locales whose single-Date skeletons differ from the previous Interval table — most notably:- ja
:mediumis now numeric ("2012/01/05~2012/01/06"), aligning with single Date:medium("2012/01/05"); was previously the abbreviated month form"2012年1月5日~6日". The richer Japanese-character form is now:long(matching single Date:long). - de
:mediumis now numeric ("15.01.2022 – 20.03.2022"); was previously the abbreviated month form. To get"15. Jan. – 20. März 2022"request the:yMMMdskeleton explicitly. - en
:longuses full month name with no weekday ("January 5, 2012 – January 6, 2012"); was previously the:yMMMEdform"Thu, Jan 5 – Fri, Jan 6, 2012". The weekday now appears at:full. Per-locale skeletons that aren't shipped in CLDR'sinterval_formatsdata fall back to formatting each endpoint withLocalize.Date.to_string/2and joining via the locale'sinterval_format_fallbacktemplate. Non-:datestyles (:month,:month_and_day,:year_and_month) remain locale-independent — they describe a deliberate field selection unrelated to standard date styles. The staticLocalize.Interval.date_styles/0no longer includes a:dateentry.
- ja
Bug Fixes
Strip zone token for NaiveDateTime too in
Localize.Time.to_string/2since they also do not have a time zone field. Relates to #22.Fix
Localize.Interval.to_string/3silently ignoring the:date_formatoption on Date-only intervals. The option now overrides:formaton the date axis, mirroring the precedence used for:time_formaton time intervals. Relates to #22.Fix
Localize.Interval.to_string/3raisingLocalize.DateTimeIntervalFormatErrorwhen called withformat: :fullon a Date interval. Relates to #22.Localize.Utils.Math.sqrt/2now respects the currentDecimal.Context.get/0precision when called with aDecimal— the result is rounded to the configured precision and Newton's-method convergence scales accordingly.Added the test suite for
Localize.Utilsthat are derived from theCldr.Utilequivalents.
[0.27.0] — May 8th, 2026
Bug Fixes
Fix
Localize.Interval.to_string/3:shorttime-interval format using the wrong hour cycle on 24-hour locales.:shortnow picks:hmor:Hmper the locale's preferred hour cycle (honouring any-u-hc-Unicode-extension override), matching the cycle used byLocalize.Time.to_string/2:short. Thanks to @woylie for the follow-up report. Fixes #22.Fix
Localize.Time.to_string/2silently ignoring the-u-hc-Unicode-extension override on the locale. The override now applies to both standard formats (:short/:medium/:long/:full) — remapped to the locale's cycle-appropriate:hm/:hms/:hmsv(12-hour, with the locale's AM/PM marker) or:Hm/:Hms/:Hmsv(24-hour) skeleton — and to user-supplied skeleton atoms like:Hms, where the hour symbols are substituted.Fix zone-field artefacts on
%Time{}standard formats. ATimecarries no zone information, soLocalize.Time.to_string/2now strips zone characters (z,Z,O,v,V,x,X) from the resolved skeleton ID before formatting.Localize.Time.to_string!(~T[21:00:00], format: :long, locale: :ja)returns"21:00:00"(was"21:00:00 "— trailing space), and:es:fullreturns"21:00:00"instead of"21:00:00 ()"(parens around the empty zone field).Adds support for
Decimalversion 3.0 to address a CVE. Thanks to @mitchellhenke for the PR.
Enhancements
- Add
Localize.Time.hour_format_from_locale/1(and!/1) returning the locale's preferred hour cycle (:h11/:h12/:h23/:h24), honouring any-u-hc-Unicode-extension override.
[0.26.0] — May 6th, 2026
This release fixes user-reported bug #22 in time interval formatting and a number of RBNF conformance bugs arising from a more complete conformance testing process. The RBNF bugs have been around unreported and undiagnosed for many years.
Breaking Change
- The default
Localize.Interval.to_string/3format output (which is:medium) for time-only inputs now includes seconds.Localize.Interval.to_string!(~T[12:00:00], ~T[14:00:00], locale: :ja)shifts from午後0時00分~2時00分to12:00:00~14:00:00.:en's:mediumshifts from12:00 – 2:00 PMto12:00:00 PM – 2:00:00 PM. Users who relied on no-seconds output should explicitly pass time_format::short.
Bug Fixes
Fix
Localize.Interval.to_string/3collapsing the:short,:medium,:long, and:fulltime styles to the same:hmskeleton on Time inputs.:shortkeeps CLDR's interval-format dispatch (collapsed AM/PM);:mediumand above route through the locale's per-style time-format pattern, restoring per-style differentiation and including seconds in the default:mediumoutput. Thanks to @woylie for the report. Fixes #22.Fix
:time_formatbeing silently ignored onLocalize.Interval.to_string/3for Time inputs. The option now takes precedence over:format, matching the precedence used on datetime intervals. Thanks to @woylie for the report. Fixes #22.Fix
Localize.Interval.to_string/3crashing withFunctionClauseErrorwhen called with a binary:format(or:time_format) on Time inputs. Binary patterns are now applied to both endpoints and joined via the locale's interval-format fallback template, matching the behaviour of datetime intervals. Thanks to @woylie for the report. Fixes #22.RBNF parser now distinguishes
>>from>>>so CJK locales emit fractional digits without an inter-digit separator —Localize.Number.Rbnf.to_string(3.14, "spellout-numbering", locale: :zh)is三点一四instead of三点一 四.RBNF leading and embedded zeros in fractional digits, and very small magnitudes, are now preserved —
0.05 enis"zero point zero five",3.04 zhis三点〇四, and0.000001 enis"zero point zero zero zero zero zero one".RBNF
0.xspecial-base rule now matches when the integer part is zero and the value is non-zero, routing ko0.5 spellout-numberingthrough its locale-correct sino-Korean영점오instead of the previousx.x-fallback공점공오.RBNF negative floats no longer double their output or silently drop the sign — ko
-0.5 spellout-numberingis-영점오instead of공점공점오, and locales that lack a-xrule now get an ASCII-prefix.RBNF integer
<#,##0<quotient and float>%name>/>#,##0>/<%name<modulo and quotient no longer crash, completing case-clause coverage for every TR35 substitution-argument shape.RBNF
$(cardinal,…)and$(ordinal,…)plural-keyed substitutions now use the requested locale's plural rules instead of hard-coding English — frLocalize.Number.Rbnf.to_string(21, "digits-ordinal-masculine", locale: :fr)is"21e"instead of"21er".RBNF fraction-with-rule numerator/denominator algorithm is now spec-correct — ky
1.5 spellout-cardinalisбир бүтүн ондон бешinstead ofбир бүтүн беш.
Enhancements
Add
:minimum_significant_digitsand:maximum_significant_digitsoptions toLocalize.Number.to_string/2.Localize.Number.Rbnf.to_string/3now acceptsDecimalinputs in addition to native integers and floats, with whole-valued Decimals routed through the integer path with no precision loss.RBNF
>>>integer modulo now applies the source-preceding rule per TR35 §RBNF_Syntax, closing a latent gap; no current CLDR locale exercises this path.
[0.25.0] — May 1st, 2026
Bug Fixes
- Fix en-CA :short date crash; teach :prefer about CLDR variant/standard alts. Thanks to @dabaer for the report. Closes #21.
Enhancements
- Module refactoring to remove many compile-time cycles.
[0.24.0] — April 29th, 2026
Bug Fixes
Localize.DateTime.Formatterstand-alone pattern helpers now passcontext: :stand_alonetoLocalize.Calendar.localize/3instead of an invalidtype:option. Thanks to @timpritlove for the PR. Closes #20.Rename calendar
:format/:stand_alonetypespec and docs from:typeto:context.Clarify
Unit.display_name/2vsto_string/2in docs.
[0.23.0] — April 25th, 2026
Bug Fixes
Fix
Cldr.Number.to_string/2forDecimalnumbers to produce the correct decimal digits.Fix
LOCALIZE_UNSAFE_HTTPSenv-var contract — values like"FALSE","nil", an empty string, or unset all keep TLS verification on; only a truthy value disables it. Thanks to @rubas for the PR. Closes #15.Fix
Localize.Locale.load/2andLocalize.Locale.get/3to honor the:provideroption —load/2no longer callsprovider.store/2with the locale id, andget/3now loads through the same provider it reads from. Thanks to @rubas for the PR. Closes #16.Localize.Locale.get/3now honors the:fallbackoption by walking the CLDR parent locale chain when a key is missing in the requested locale. Fallback is handled inLocalize.Localeso provider modules stay focused on store-and-fetch semantics. Thanks to @rubas for the PR. Closes #17.Public formatters (
Localize.Date,Localize.Time,Localize.DateTime,Localize.DateTime.Relative,Localize.Interval,Localize.List,Localize.Calendar) now accept raw parsedLocalize.LanguageTagstructs whose:cldr_locale_idis not yet populated. The seven per-module locale resolvers collapse to one sharedLocalize.Locale.cldr_locale_id_from/1. Thanks to @rubas for the PR. Closes #18.Fix
Localize.available_locale_id?/1,Localize.validate_calendar/1, andLocalize.validate_number_system/1to never intern caller-supplied strings as new atoms. Lookups now use compile-time string→atom maps for O(1) safe membership. Thanks to @rubas for the PR. Closes #19.Localize.supported_locales/0now lazily resolvesconfig :localize, supported_locales: [...]from the application environment when the:persistent_termcache has not yet been populated, instead of falling back to the full CLDR locale list. The cache is populated on application startup, but callers that run before the application has started — notably compile-time macro expansion in dependent applications likelocalize_web's~qsigil — previously saw the full CLDR list during partial recompiles. This causedLocalize.validate_locale/1to best-match against all CLDR locales rather than the configured subset, producing incorrectcldr_locale_idresolutions.
[0.22.0] — April 22nd, 2026
Bug Fixes
- Fix Cldr.Number.to_string/2 for Decimal numbers to produce the correct decimal digits.
[0.21.0] — April 22nd, 2026
Bug Fixes
Fix normalizing CLDR locale names to our standard atom format in
Localize.validate_calendar/1.Localize.Calendar.iso_day_of_week/1no longer crashes withMatchErroron non-ISO calendars. The generic branch destructuredcalendar.day_of_week/4as a 2-tuple but theCalendarbehaviour returns{day, first, last}.Localize.Time.to_string/2with a partial time and a standard format atom (:short/:medium/:long/:full) now derives a CLDR skeleton from the fields actually present (:h,:hm,:ms) instead of returningDateTimeUnresolvedFormatError.Localize.DateTime.to_string/2no longer silently drops the hour when given a partial datetime such as%{year: _, month: _, day: _, hour: _}without:minute. Partial datetimes render via a split date + time path composed with the locale's datetime wrapper.Localize.DateTime.to_string/2with hour + minute (no second) under:mediumno longer emits a stray trailing:before the AM/PM marker — the partial path derives the:hmskeleton instead of using the fullh:mm:ss apattern with an empty seconds slot.The datetime formatter's AM/PM handler now accepts any map with
:hour, not just maps that also have:minute.Localize.Number.to_string/2now produces identical output for equivalentDecimaland float values. PreviouslyDecimal.new("1234.56")rendered as"1,234.560"under the standard pattern becauseDecimal.round/3returns a result padded to the requested scale; the formatter now normalizes after rounding so only the digits actually needed are emitted. Currency and other formats with a mandatory minimum scale still pad correctly viaadjust_trailing_zeros/2.
[0.20.0] — April 22nd, 2026
Bug Fixes
- Fixes mapping CLDR calendar types to the implementation module name.
[0.19.0] — April 19th, 2026
Bug Fixes
- Restored the support of RBNF locales in
Localize.Number.to_string/2. They are implemented inLocalize.Number.Rbnf.to_string/1but the delegation was lost on theex_cldrtransition. Thanks to @tangulip for the report. Closes #11.
[0.18.0] — April 18th, 2026
Breaking Change
MF2 highlighter token class atoms renamed to match the tree-sitter capture taxonomy used by
mf2_wasm_editor, so one stylesheet now styles both server-rendered HTML and the browser editor.Localize.Message.to_html/2now emits the new canonical class names with_converted to-on output (.mf2-variable,.mf2-punctuation-bracket,.mf2-string-escape,.mf2-constant-builtin, etc.).Localize.Message.to_ansi/2default palette keys renamed to the new atoms.
Removed
- The
mf2_theme_css/directory andscripts/generate_mf2_themes.exsgenerator. Themes now live canonically inmf2_wasm_editor.
Bug Fixes
Localize.Gettext.Interpolation.runtime_interpolate/2no longer raisesLocalize.ParseErrorwhen a translated string is not valid MF2. It now returns the message unchanged and logs a warning, matching gettext's own "fall back to the msgid" behaviour for missing translations. Dev-facing UI copy that happens to contain MF2-like syntax (e.g.{{…}}or.match) no longer crashes callers.
[0.17.0] — April 17th, 2026
Added
mix formatpluginLocalize.Message.Formatter.Plugin. Canonicalises MF2 messages in~Msigils and standalone.mf2files. Enable by adding the plugin to.formatter.exs. See the "mix formatplugin" section in the MessageFormat 2 guide.
[0.16.0] — April 17th, 2026
Bug Fixes
- Fix locale download infinite recursion loop. Thanks to @woylie for the report. Closes #10.
[0.15.0] — April 17th, 2026
Added
- MF2 syntax highlighter. See
Localize.Message.to_tokens/2,Localize.Message.to_html/2andLocalize.Message.to_ansi/2.
Bug Fixes
- Fix the exception and message when formatting a number and specifying a number system that is not valid for the given locale.
[0.14.0] — April 16th, 2026
Breaking Change
- Remove
@deriveforJasonsinceJasonis no longer configured or used anywhere in the application.
Bug Fixes
- Fix locale downloader to ensure it only uses the
:cldr_locale_idfield to construct the download URL.
[0.13.0] — April 15th, 2026
Bug Fixes
Localize.Interval.to_string/3now correctly formats datetime intervals — matchingex_cldr_dates_timesbehaviour. Previously any interval between two datetime values was rendered as a date-only range, discarding the time portion. Now same-day intervals render as"Apr 8, 2026, 12:00 PM – 2:00 PM"(date once, time range) and different-day intervals render as"Apr 15, 2026, 12:49 AM – Apr 16, 2026, 1:49 AM"(full datetime on both sides). Time-only intervals (Timevalues on both sides) use the locale's time-interval patterns.
[0.12.0] — April 15th, 2026
Bug Fixes
Chinese collation tailorings (
zh-u-co-pinyin,zh-u-co-stroke,zh-u-co-zhuyin) now produce correct locale-specific ordering for Han characters. .Han radical-stroke ordering (UAX #38) under
-u-co-unihannow applies correctly. TheLocalize.Collation.Hanmodule was previously orphaned — its data was never loaded in consumer apps and the sort path never consulted it. Radical data is now pre-generated in the build pipeline and shipped inpriv/localize/collation_table.etf; the sort path invokesHan.collation_elements/1for CJK codepoints when the:han_orderingoption is:radical_stroke(set automatically for the-u-co-unihancollation type).
Added
Localize.Collation.Options.han_orderingoption —:implicit(default, UCA codepoint-based) or:radical_stroke(UAX #38). Automatically set to:radical_strokefor-u-co-unihanlocales.Persistent-term cache for parsed tailorings. First call to
Tailoring.get_tailoring/2parses the rule string (~70 ms for zh-pinyin); subsequent calls read from persistent_term in microseconds.Differential tests for
zh-u-co-pinyin,zh-u-co-stroke,zh-u-co-zhuyin, andja-u-co-unihanthat assert output differs from root codepoint order for specific character pairs — guards against silent regressions.
Changed
Localize.Collation.Hanis no longer a GenServer. Radical data is loaded alongside the main collation table byLocalize.Collation.Table(one ETF, one load step).
[0.11.0] — April 14th, 2026
Added
Localize.Interval.to_string/3now acceptsnilfor either thefromortoendpoint to format an open interval (e.g."Jan 1, 2020 –"or"– Jan 1, 2020").New guide: Interval and Duration Formatting — covers
Localize.Interval(including open intervals) andLocalize.Duration(calendar-unit strings and numeric time strings) in one place.
[0.10.0] — April 14th, 2026
Changed
- Mix tasks now only do
Mix.Task.run("app.config")followed byApplication.ensure_all_started(:localize), avoiding starting any consumer application. Thanks to @lostkobrakai for the report. Closes #7,
[0.9.0] — April 14th, 2026
Changed
Localize.Unit.Math.mult/2andLocalize.Unit.Math.div/2now factor operands that share the same base dimension.
[0.8.0] — April 14th, 2026
Added
Localize.Message.format_to_safe_list/3andformat_to_safe_list!/3— new MF2 formatting entry points that preserve markup structure instead of stripping it.
[0.7.0] — April 14th, 2026
Changed
- Territory subdivision functions are now in the Localize.Territory.Subdivision module. Some functions have been renamed, see
Localize.Territory.Subdivision. The translate functions have been removed.
[0.6.0] — April 13th, 2026
Added
- Public function wrappers in
Localize.Unit.Mathfor all dimensionless functions:sin/1,cos/1,tan/1,asin/1,acos/1,atan/1,sinh/1,cosh/1,tanh/1,asinh/1,acosh/1,atanh/1,exp/1,ln/1,log/1,log2/1. Previously these were only accessible viaapply_dimensionless/2.
Bug Fixes
apply_dimensionless/2now validates that the unit is actually dimensionless before computing. Previouslysin(1 meter)would silently return a result; it now returns{:error, "sin requires a dimensionless value, got unit with base: meter"}. Units must reduce torevolution(angles) orpart(ratios) to be accepted.
[0.5.0] — April 13th, 2026
Added
:specialconversion support inCustomRegistry. Custom units can now be registered withfactor: :specialplus:forwardand:inverse{module, function}tuples for nonlinear conversions. This enables logarithmic scales (decibels), temperature functions, density hydrometers, wire gauges, and other conversions that cannot be expressed asvalue * factor + offset.Conversion.do_convert/3now uses a generalisedspecial_unit/1lookup that checks bothCustomRegistryand a compiled@built_in_specialmap, replacing the previous hardcoded:beaufortpattern match.
[0.4.0] — April 13th, 2026
Bug Fixes
Localize.all_locale_ids/1(:modern,:moderate,:basic) now returns the correct expanded list of locales. Thanks to @cw789 for the report.
[0.3.0] — April 13th, 2026
Bug Fixes
- Load custom units in a single batch to avoid churning
:persistent_store
[0.2.0] — April 13th, 2026
Bug Fixes
- SI prefix parsing for custom units. Custom units can now be prefixed with SI prefixes and power prefixes.
Enhancements
- Custom unit category validation relaxed from a fixed allowlist to any non-empty string. The faciliates importing a broader range of unit definitions such as those from Gnu units.
[0.1.0] — April 13th, 2026
Initial release.
Highlights
Full CLDR v48.2 locale data with lazy runtime loading from ETF files cached in
:persistent_term. No compile-time backend configuration required.Number formatting — integers, decimals, percentages, currencies, ranges, and rule-based number formats (RBNF) including Roman numerals and CJK ideographs.
Date, time, and datetime formatting using CLDR calendar patterns with
:short,:medium,:long, and:fullstyles, custom skeleton patterns, and interval formatting.Unit formatting with plural-aware patterns, SI/binary prefixes, compound units, measurement system conversion, custom unit registration, and
Localize.Unit.Operatorsfor natural arithmetic (km + m).List formatting with locale-appropriate conjunctions, disjunctions, and unit list styles. Per-element formatting via
Localize.Chars.ICU MessageFormat 2 (MF2) parser and interpreter with custom function registry, offset selection, JSON interchange, and bidirectional text support.
Gettext integration —
Localize.Gettext.Interpolationprovides MF2-based interpolation for Gettext backends.Localize.Charsprotocol — polymorphic locale-aware formatting with built-in implementations for 14 types andAnyfallback toKernel.to_string/1.Currency metadata, ISO 4217 validation, custom currency registration (private-use and extended codes), and territory-to-currency mapping.
Display names for territories, languages, scripts, calendars, and full locale display names per the CLDR algorithm.
Unicode Collation Algorithm (UCA) with CLDR locale-specific tailoring for 97 languages, including digraph expansion and script reordering.
BCP 47 / RFC 5646 language tag parser with full Unicode extension support (
-u-,-t-), locale distance matching, and parent chain resolution.On-disk locale cache with HTTPS download provider, version-based staleness detection, and
mix localize.download_localesfor build-time cache population.Optional NIF backend for faster Unicode normalisation and collation sort-key generation.
Calendar data for all CLDR calendar systems including Buddhist, Hebrew, Islamic (5 variants), ROC, Indian, Persian, Coptic, Ethiopic, Chinese, Japanese, and Dangi.
All public API functions return a standardized
{:error, exception}(except bang variants). The exception is a standard Elixir exception struct populated with semantic information about the error. The error message can be returned byException.message(exception). The exception messages are all Gettext messages using the MF2 format and can be localized.
See the README for full documentation, configuration options, and usage examples.