Translations
Brix translations give every request one resolved locale and one typed translator, shared by server handlers, SSR, islands, fragments, and semantic Markdown. Brix owns typed lookup, locale resolution order, request-local dictionary loading, hydration filtering, and locale-safe edge caching. Your application owns the locale list and selection policy, the message keys and text, the dictionary source, and its cache and invalidation.
Brix treats messages as opaque strings. It does not interpret ICU syntax, select plurals, interpolate placeholders, or render message text as HTML; choose a formatting strategy separately. A checked-in dictionary is enough to start. Contentful or another remote source is optional.
A translated application has four parts:
- a finite key union and
defineTranslationsinsrc/brix.ts, which also exportsuseTranslateanduseLocale; - a server
loadcallback insrc/brix.server.ts, which also exportsgetTranslatorandgetLocale; - components that call
useTranslate()with string-literal keys, so the build can send each island only the messages it uses; - server code, including Markdown callbacks, that awaits
getTranslator(c).