Limitations
What dxn_i18n leaves out or does differently - ignored number options, currency digits, time zones, the f64 offset, default bidi, lookup rules - and what to do instead.
What the library does not do, where it differs from what you might expect, and the alternative where there is one. Version 0.1.0.
#Left out
- Significant digits, notation and compact numbers.
minimumSignificantDigits,maximumSignificantDigits,notation,compactDisplay,currencyDisplayandcurrencySignare accepted on:numberand ignored, without an error.1234.5withnotation=compactshows1,234.5. Format such a value in your code and pass the text. - Currency fraction digits and names. A currency shows its own fraction digits (two for euros, none for yen) and its symbol.
minimumFractionDigits,maximumFractionDigitsanduseGroupingdo not apply, and there is no “euros” or “EUR” display. - Time zones. A date is a wall time (
dxn_intl::DateTime): no zone, no offset, no zone names. ISO 8601 text withZor an offset is a bad operand. Convert instants to the user’s local time before formatting (Dates and times). - Relative times, lists, units and collation. “In 3 days”, “A, B and C”, “5 km” and sorting rules are not provided. dXn.Intl, which does the formatting here, lists the same gaps.
- Other message formats. Messages are MessageFormat 2 only: no ICU MessageFormat 1 (
{n, plural, one {...}}), gettext or Fluent syntax, and resources are JSON objects. - Loading and watching. The crate takes JSON text and locale tags. Reading files or assets, following the system language and reloading on change belong to your app or to a framework wrapped around this crate.
u:idand attributes in parts.u:idis accepted and ignored, and attributes (@name) are parsed but not part ofPart.
#Behavior with caveats
- Bidi isolation is off by default. Turn on
BidiIsolation::Defaultfor mixed-direction text (Text direction).Message::formatnever isolates. :offsetusesf64. Integers above 2^53 can come out off by one or more. Use it for counts.selectis literal-only.select=$modeis a bad option, because which forms a message has is the translator’s decision.- Amounts of money and dates do not select. A matcher on
:currency,:date,:timeor:datetimematches only*. - Values format in the message’s language. A fallback-language message formats numbers and dates in that language with the user’s
-u-preferences, not in the user’s region (The Translator). - Script matters in the lookup.
zh-TW(Traditional) does not fall back to azh-Hansbundle; add azh-Hantbundle or list it in the fallbacks. - Parent lookup removes the region.
de-ATfindsde; the chain is not configurable beyond the fallback list. - Number text is strict. Text arguments for
:numbermust be JSON number syntax." 5","+5",".5"and"1_000"are bad operands. - The category follows the digits shown.
minimumFractionDigits=1changes1to1.0, which is notonein English. - Duplicate ids. Two JSON entries that make the same id (
"a.b"and a nesteda/b) replace each other. - Locale data is compiled in. ICU4X’s data for the formatters you use is part of your binary, and a program carries only the data of the formatters it uses (dXn.Intl).
- Debug builds log unknown currencies. A well-formed currency code the data does not know formats as the code, and a debug build also prints an ICU4X data error to standard error.
- Draft functions.
:offset,:percent,:currency,:date,:timeand:datetimefollow the specification’s draft; their options can change with it. - No docs.rs page. The crate is consumed as a git tag, so build the API reference locally with
cargo doc --open.
#Not covered by tests
- Output depends on the CLDR data inside
dxn_intl. The conformance suite usesen-USand a few locales; per-language plural, date and number output isdxn_intl’s and ICU4X’s to prove. - CI checks the
wasm32-unknown-unknownbuild withcargo check; it does not run the library in a browser.
Next: Releases.