* langkit: one way to be multilingual across the fleet A survey of the bitbaum repos (docs/survey-2026-11-29.md) found 22 apps with more than one language: 14 on next-intl, 8 with their own tables, and around them 8 private Accept-Language parsers, 4 cookie names and 12 home-made completeness checks. The decision (docs/decision.md) keeps ICU MessageFormat on next-intl's engine and puts the repeated parts in one package: - defineLanguages: the list, names, direction, fallbacks, regional variants - pickLocale: the reader's choice, the browser, the content, the default - createMessages: typed ICU messages on use-intl/core, usable in server components without a provider; de-CH is German respelled, not a file - langkit check: missing/extra/empty keys, ICU syntax, arguments, plural forms, ß in Swiss German; for each app's verify - toIcu: drafts ICU messages from hand-written copy tables - LanguageSwitcher: plain links, fits sitekit's masthead actions Proof without touching the app: BiasLens's rewrite-copy.ts (copied at c3497b7 as a fixture), all 107 entries in en, de, de-CH and fr, says the same through langkit. Two deliberate differences are asserted as tests. Not on npm yet: a new package needs the owner's one npm sign-in (README). Claude-Session: https://claude.ai/code/session_019MDtmsTRGc34xnG6koVuAY * langkit: private until its first publish A merged version bump publishes from GitLab, and npm cannot trust a package that does not exist yet. Marked private so the merge starts no publish that must fail; publishing 0.1.0 is the owner's one npm sign-in plus removing this line. Claude-Session: https://claude.ai/code/session_019MDtmsTRGc34xnG6koVuAY --------- Co-authored-by: Claude <noreply@anthropic.com>
6.6 KiB
Last verified: 2026-11-29
Decision: one message format and engine for the fleet
Recommendation: ICU MessageFormat, formatted by next-intl's engine
(use-intl), with @bitbaum/langkit as the fleet's shared layer on top of
it. An app with a language in its URL keeps next-intl for routing, as the
template already does. An app without one (BiasLens, where the language is the
report's) uses langkit alone and gets the same messages, types and formatting.
No message format was invented.
The facts about the fleet are in the survey. The facts
about each library were read on 2026-11-29 from the npm registry (npm view)
and from the published package itself (its package.json, README.md and
type declarations, installed into a scratch folder); where something was not
tried, it says so.
What was compared
| next-intl / use-intl | FormatJS (@formatjs/intl, intl-messageformat) |
Paraglide JS | |
|---|---|---|---|
| Version, last publish | next-intl 4.16.2 (2026-11-25); use-intl 4.15.1 (2026-11-12) | @formatjs/intl 6.2.1, intl-messageformat 12.2.1 (both 2026-11-23) |
@inlang/paraglide-js 3.2.2 (2026-11-10) |
| Licence | MIT; depends on intl-messageformat (BSD-3-Clause) |
MIT; intl-messageformat is BSD-3-Clause |
MIT |
| Message format | ICU MessageFormat | ICU MessageFormat (it is the reference JavaScript implementation; use-intl depends on it) | Its own project format with plug-ins; ICU syntax through a plug-in (README, "Message Format") |
| In the fleet today | 14 apps, the app template, and STACK.md's "i18n" row |
Underneath those 14, not used directly by any app | None |
| Server components, no client bundle | Yes: the package has react-server export conditions (package.json, exports), and use-intl/core (createTranslator, createFormatter) has no hooks and needs no provider — test/messages.test.js runs it in plain Node |
Yes: plain functions | Yes by design: messages compile to functions (README, "Why Compiler-First?") |
| Typed keys | Yes: keys and namespaces from the default language's table (AppConfig; used by solon and evig), and argument names from the message text when the table is a literal (use-intl ICUArgs) |
Flat message ids can be registered through a global FormatjsIntl.Message interface (@formatjs/intl index.d.ts); nested tables and namespaces are the app's to build |
Yes: each message is a generated, typed function (README, "Fully Typesafe") |
Missing-key check for verify |
Not in the package. Its README points to a companion linter, @eloqnt/cli (0.8.0, first published 2026-06-17, MIT) — not run for this decision |
Its parser (@formatjs/icu-messageformat-parser, MIT) is what a check needs; the check itself is the app's |
Not examined |
| Plurals, dates, numbers | ICU plurals and selects in messages; createFormatter for dates, numbers, lists and relative time, all on Intl |
The same, one level lower | Intl.PluralRules, NumberFormat, DateTimeFormat through its declarations (README, "Message Format") |
| Regional spelling as a transform | Not a feature, but messages are plain data loaded by the app's own function, so a table can be respelled before it is used (what langkit does) | Same: plain data | Messages are compiled at build time into functions; a variant would be a generated second locale or a wrapper around every function — not tried |
| Build step | None beyond Next | None | A compiler and a bundler plug-in. The README documents Vite frameworks (React + Vite, TanStack Start, SvelteKit); the package ships other bundler plug-ins (dist/bundler-plugins) and lists "nextjs" among its keywords, but a Next.js App Router setup was not tried |
| Cost to adopt | 14 apps: none for the format; they swap copied helpers for langkit's. 8 apps: convert tables to ICU (langkit's toIcu drafts it) |
The same conversion, plus writing key lookup, namespaces, fallback and typing that use-intl already has | All 22 apps convert their messages and their call sites (t("key") becomes m.key()), and each build gains a compiler |
Why this one
- It is already the fleet's choice, and it holds up.
STACK.mdsays next-intl; fourteen apps and the template run it. The survey found no failure caused by the format or the engine. The failures are all in what each app wrote around it. - The same engine works where next-intl's routing does not fit. BiasLens
has no language in its URL; the language belongs to the report.
use-intl/coretakes a language and a table and returns a typedt, on the server, with nothing shipped to the browser. That is why langkit depends onuse-intland not onnext-intl: one engine, two ways in. - Swiss German stays a transform. Messages are data until the moment they
are formatted, so
de-CHis the German table passed through two replacements. With a compiler in the middle, that would be a second generated locale. - FormatJS directly would mean rebuilding use-intl. Same format, same parser — minus nested keys, namespaces, typed arguments and the formatter object. langkit does use FormatJS's parser directly for one thing, the check, because a check needs the syntax tree and nothing else.
- Paraglide solves a problem the fleet does not have, at the price of the one it does. Its strength is shipping fewer message bytes to a client-rendered app. The fleet's pages are server-rendered, so messages mostly never reach the browser. Its price is rewriting every call site in twenty-two apps and adding a compiler to each build.
What this does not decide
- Whether an app's language is in the URL. causius, evig, skif and solon each wrote down why they chose what they chose. langkit's picker takes "what the reader chose" as an input and does not care where it was stored.
- Whether to replace langkit's check with
@eloqnt/cli. It is from next-intl's author and may become the better tool. It is below 1.0 and was not evaluated. langkit's check is about 200 lines on FormatJS's parser and carries three rules the fleet needs (ß in Swiss German, namespaces declared as not yet translated, plural forms for the numbers a page shows). Revisit when eloqnt reaches 1.0. - Translation itself. Who translates, and how a machine translation is marked until a person has read it (aoz-begleitung and Substrata each have a rule), stays with the app.
Measured, for scale
use-intl 4.15.1's core entry and the two chunks it loads are 2.9 kB
gzipped (374 + 585 + 1921 bytes: core.js, formatters-*.js,
initializeConfig-*.js in dist/esm/production), before intl-messageformat
and its parser, which it imports. In a server component none of it is sent to
the browser.