FUNCTIONS / @SPFN/I18N — INTERNATIONALIZATION RUNTIME

Words,
in context.

@spfn/i18n supplies the small runtime between your translation catalogs and your UI: interpolation, fallback lookup, server helpers, and React context. Your application keeps ownership of the words and the locale policy.

Read the reference Get started $ pnpm add @spfn/i18n
01
The boundary

The runtime translates.
Your app decides.

Catalog loading, locale detection, routing, persistence, and content stay in the consuming application. The runtime accepts plain locale → namespace → message objects and turns them into predictable translators without imposing a file layout, fetch layer, or CMS.

app locale
catalog namespace
fallback merge
translated string
FIG 01 — APPLICATION-OWNED CONTENT · RUNTIME-OWNED LOOKUP
02
Server to client

Only the messages
this subtree needs.

getClientMessages() resolves selected namespaces on the server, merging fallback values first and locale-specific values second. Pass the serializable result through I18nProvider; client components call useT() without a loading flash or a second catalog request.

getClientMessages
selected namespaces
I18nProvider
useT
FIG 02 — RESOLVE ON THE SERVER · SERIALIZE ONCE · READ FROM CONTEXT
03
What's inside

The translation layer,
nothing extra.

Translate the surface.