Skip to content
brix.v2.15.0+b120c49

Search documentation

Loading search…

    Documentation menu
    Docs / Pages and UIRead Markdown
    On this page

    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 defineTranslations in src/brix.ts, which also exports useTranslate and useLocale;
    • a server load callback in src/brix.server.ts, which also exports getTranslator and getLocale;
    • 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).

    Configure locales and dictionary loading

    #

    Define the browser-safe translation contract, load dictionaries, resolve locale, choose fallback behavior, and report missing messages.

    Translate and test output

    #

    Translate components, server code, and semantic Markdown, keep edge caches locale-safe, and test routes, components, and stories.