A language (40 passages, no note) is described by data, never by code: a folder holding pack.yaml (the name of the language, its apostrophes (3 passages, no note), its collation options, its plural (3 passages, no note) suffix rules (5 passages, no note), validated by the language pack (note: Language pack) schema (31 passages, no note)) and stopwords.txt. The engine (13 passages, no note) ships en and fr; a regional variant (3 passages, no note) such as fr-CA uses the pack of its language (3 passages, no note) until a more specific one is registered; any other language comes as a pack shipped by a plugin (note: Plugin), registered when the plugin loads, and a locale (note: Locale) with no pack is a build (3 passages, no note) error (29 passages, no note). Every source selects its pack through its BCP 47 locale (note: Locale per source), which decides its comparison form (note: Comparison form), its default stopwords (note: Stopword), its word segmentation (3 passages, no note) and the collation of its indexes (3 passages, no note). The architecture guide states (36 passages, no note) the design (4 passages, no note).
Steps
- Write the pack: a folder with
pack.yamlnaming the language, its apostrophe characters (16 passages, no note), its collation options (4 passages, no note) and its plural suffix rules (4 passages, no note), andstopwords.txt, one word per line,#opening a comment; validate (10 passages, no note) the file againstlanguage-pack.schema.json. - Ship it in a plugin that registers (3 passages, no note) the pack under its locale tag when it loads, and declare the plugin under
plugins:of the configuration (note: Configuration); a project (note: Project) that also wants type prefixes (3 passages, no note) in that language adds them to its profile (note: Profile) undertype_prefixes, per locale, without touching the pack. - Declare the locale on the source (note: Source),
locale: <tag>, or on the project when it is the default; a tag with no pack (3 passages, no note) registered fails the build (note: Build) with the tag (18 passages, no note) named. - Build, and read the summary (24 passages, no note) and the findings: the dictionary (note: Dictionary) of that locale is built from the titles and aliases (11 passages, no note) of its entities (note: Entity) and the pack's stopwords, its occurrences (note: Occurrence) are scanned with the pack's normalisation, and its index (note: Alphabetical index) collates with its rules (note: Rule).
- Give the interface (21 passages, no note) its labels (44 passages, no note): the site (note: Site) takes every label from a message catalogue per locale (3 passages, no note); a locale without one falls back to English until the catalogue (12 passages, no note) exists.