Skip to main content

Crate mf2_locale_data

Crate mf2_locale_data 

Source
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.ordinal entries; the CLDR @integer/@decimal samples 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 the number.symbols / number.patterns entries built from them (number);
  • currencies and units, from every locale’s currencies.json and units.json (data/currencies.txt, data/units.txt, deduplicated against the parents and CLDR’s fallbacks), and the currency.data / unit.data entries for the configured sets (currency, unit);
  • language matching, from likelySubtags.json, languageMatching.json and territoryContainment.json (data/matching.txt): what mf2’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§

CldrVersion
The CLDR version of a catalog’s locale data.

Enums§

Error
A problem with the shipped rule table or the CLDR input.
ParseError
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): Rtl or Ltr.