waybetter/packages/waybetter/i18n-meta.schema.json
CRT 36d6a81079 i18n: dependency-free message runtime, catalog checks, plugin strings, native strings
- runtime/i18n.ts: ICU-lite messages (placeholders as text, Intl.PluralRules plurals with exact
  forms, selectordinal, select, number/date/time), fallback chains (pt-BR -> pt -> en, ar-x-fm ->
  ar), X and legacy code aliases, RTL by locale, lazy catalogs, live onChange. Apostrophes are
  literal except right before { } # or another apostrophe.
- runtime/i18nCheck.ts: rules for contributed catalogs (shape, keys, syntax, placeholder parity,
  select options, markup/control characters, lengths). An argument English only uses to choose a
  plural form may be dropped; missing plural forms are warnings; meta "allowEmpty" fragments.
- runtime/pluginI18n.ts: api.i18n bound per plugin (register/t/locale/dir/onChange/number/date/
  relative/list); the UI kit's own words follow the app's language. pageLang.ts reports the
  site's <html lang>. shell/messages.ts: shell-model words.
- waybetter-host i18n.rs: NativeStrings (validated plain text, caps, one-pass {name} fill, page
  payload by prefix), system_locales via sys-locale; TabState.lang.
- JSON Schemas for catalogs and translator notes; npm exports waybetter/i18n, /i18n/check,
  /i18n/plugin.
2026-09-29 09:53:48 +07:00

26 lines
1.2 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://waybetter.fyi/schema/i18n-meta.schema.json",
"title": "wayBetter locale catalog notes (en.meta.json)",
"description": "Notes for translators, one entry per source key: where the text appears and anything that constrains it. A plain string is the description.",
"type": "object",
"properties": { "$schema": { "type": "string" } },
"patternProperties": {
"^[a-z][A-Za-z0-9]*([._-][A-Za-z0-9]+)*$": {
"oneOf": [
{ "type": "string", "minLength": 1 },
{
"type": "object",
"additionalProperties": false,
"properties": {
"description": { "type": "string", "minLength": 1 },
"context": { "description": "Where it appears (button, tooltip, menu item, native dialog title).", "type": "string" },
"maxLength": { "description": "Hard limit in characters (tight buttons, menu items).", "type": "integer", "minimum": 1 },
"allowEmpty": { "description": "A sentence fragment that some languages leave empty because their word order moves it into a neighbouring string.", "type": "boolean" }
}
}
]
}
},
"additionalProperties": false
}