Expand description
mf2-locale-data — the locale data Rust MF2 catalogs carry, build side
only: never linked into a client.
The crate ships its data, derived from Unicode CLDR, in data/: a build
downloads nothing. From CLDR’s JSON:
- plural rules and each locale’s text direction: the UTS #35 rule parser, the canonical encoder
of the
plural.cardinal/plural.ordinalentries; the CLDR@integer/@decimalsamples of every locale are tests of the client evaluator; - numbers, from every locale’s
numbers.json: symbols, grouping, numbering systems and their digits, the percent and currency patterns, deduplicated against CLDR’s parent locales (data/numbers.txt), and thenumber.symbols/number.patternsentries built from them (number); - currencies and units, from every locale’s
currencies.jsonandunits.json(data/currencies.txt,data/units.txt, deduplicated against the parents and CLDR’s fallbacks), and thecurrency.data/unit.dataentries for the configured sets (currency,unit); - language matching, from
likelySubtags.json,languageMatching.jsonandterritoryContainment.json(data/matching.txt): whatmf2’s one locale matcher reads, cut to a corpus’s languages for its generated module (matching).
A corpus’s needs — which entries, which currencies and units — are
LocaleNeeds / NumberNeeds (NumberNeeds::add_message reads them
off the data model); locale_entries writes the entries.
§What 2.x promises here
mf2-build and mf2’s compile feature use this crate; an application
never names it. Its tables and entry builders are the catalog’s layout,
which 1.x does not promise (docs/versioning.md), so they are hidden
from the documentation. What is promised: the errors a build can return
from here (Error, ParseError), the CLDR release the data comes
from (CLDR_VERSION) and a locale’s text direction.
§The user guide
The Rust MF2 book is the user
guide: how the crates fit together, web and native applications, the
command line, and what 2.x promises.
An application reaches this crate through mf2-build
and mf2’s compile feature.
Structs§
- Cldr
Version - The CLDR version of a catalog’s locale data.
Enums§
- Error
- A problem with the shipped rule table or the CLDR input.
- Parse
Error - A syntax error in one
pluralRule-count-*string.
Constants§
- CLDR_
VERSION - The CLDR release the shipped data comes from (
third_party/cldr-json/PIN).
Functions§
- direction
- The direction of
locale(a BCP 47 tag;_is read as-, case is ignored):RtlorLtr.