In short
Every text is translated where it is shown, through helpers that ask the Core API for the answer in the
request locale. This page is for Site and Module authors who add visible copy and need to know how it is
declared, translated and kept free of dynamic values.
How it fits
@phis/ui owns the server-only helpers, Label Sets and structured documents. Persistence, storage, provider
requests and the set of supported locales belong to the Core API, which returns the resolved request locale
from GET /api/v1/site/locale. Platform copy is translated once with the global helpers, from English. A
Site's own words are translated with the Site-scoped helpers.
What matters
Two scopes. tr and trBulk translate Site-scoped messages. trGlobal and its bulk forms translate
platform copy, whose source locale is always en.
Failure returns the source. A failed request returns the source text, and the helpers never throw for a
translation failure.
No values inside strings. Names, email addresses, URLs and similar data are never part of a translated
string. Source text uses %1, %2 and so on, and the values are applied after translation.
Label Sets for UI copy. definePhiLabelSet declares captions under semantic keys. A Module package takes
its helpers from @phis/ui/module/labels, never from @phis/ui/server-helpers.
Site copy placeholders. Widget copy may name the Site, its wordmark, its host and the year through
placeholders. They are masked before translation and filled afterwards.
One source locale per Module. Every Runtime Module declares one sourceLocale, and omission means
English.
Example
import { definePhiLabelSet, PHI_TR_CTX_WEB_UI_LABEL } from "@phis/ui/module/labels";
const labels = definePhiLabelSet({
key: "account",
ctx: PHI_TR_CTX_WEB_UI_LABEL,
labels: { save: "Save" },
});