Skip to content

i18n: flat JSON, named placeholders, CLDR plurals

Accepted.

2026-11-03 (owner rulings).

Applications built on the framework serve people who read more than one language, including screens used by field staff. The server-rendered UI kits had English text compiled into their components. A mechanism was needed that Java and Go implement identically, that translators can edit without tooling, and that can be checked by tests.

The usual heavy option is ICU MessageFormat, with its own embedded syntax for plurals, selects and number formatting. It needs a large library on each side and is easy for translators to break.

  • English is the source language, the default and the fallback for every message.
  • A catalog is one flat JSON file per language: an object of message key to message. Keys are namespaced (kit. for the UI kits, validation.<CODE>, flash.<key>, and the application’s own).
  • Placeholders are named: {name}, replaced by the argument’s text. {{ and }} are literal braces. Nothing else is syntax.
  • A message may be a plural object keyed by CLDR plural categories (zero, one, two, few, many, other; other is required). The category comes from the count argument by the language’s CLDR cardinal rule. Rules shipped are English, Afrikaans and Zulu; any other language uses English’s rule until one is added.
  • Lookup falls back per key: the full tag, then the language, then English. A key missing from English renders the key and fails a test.
  • The locale is resolved once per request, in order: the user’s preference, the tenant’s default, Accept-Language, then English. The result is always a tag the application declared.
  • Layers: the kit catalog first, then the application’s on top. The catalog files are shared by the Java and Go kits.
  • Dates, numbers and money are not formatted on the server. The server writes plain values and the resolved locale and the browser formats them with Intl. API error bodies keep their code and English message.
  • Checks: every key exists in English, every placeholder in a translation exists in the English message, and a report lists untranslated keys.

Good:

  • Catalogs are plain JSON that anyone can edit and diff.
  • Both languages need only a small implementation, with no locale data tables.
  • Conformance vectors pin lookup, fallback, placeholders and plurals.

Bad:

  • No gender, select or nested-argument forms. A language that needs them will force a revisit.
  • Plural rules must be added language by language.
  • Formatting depends on the browser, so a page without JavaScript shows the plain value.
Alternative Why not
ICU MessageFormat Heavy dependency in both languages and error-prone for translators.
Locale formatting data on the server Adds CLDR tables to the binary; the browser already has them.
Per-component translated strings in code Not editable by translators and not testable as a set.