Internationalisation
Two things, kept apart — the locale Ark's machines format by, and the words a component draws, which are props.
en-US: 1,234,567.891 · 4.2 MB
es-ES: 1.234.567,891 · 4,2 MB
de-CH: 1'234'567.891 · 4.2 MB
A component here has two ways of being in a language, and they are not the same mechanism.
The locale
LocaleProvider sets the locale (and dir) that every machine below it formats and orders by:
FormatNumber, FormatByte, DatePicker's months and weekdays, useFilter's collation, the
number and date inputs. Put one at the root of a product that is not in en-US; nest one to give a
region another. useLocale() reads it.
import { LocaleProvider, useLocale } from "@kanzo-tech/ui";<LocaleProvider locale="es-ES">
<App />
</LocaleProvider>It renders no element, so it costs no DOM node and sits anywhere. useLocale is Ark's
useLocaleContext, under the name Shark UI gives it.
It translates nothing. A DatePicker that says "junio" is formatting, and that comes from here.
The word "Add" on a FieldArray is not formatting, and it does not.
The words
Every word a component draws is a prop on it, with an English default and no catalogue behind it:
| Component | Props |
|---|---|
FieldArray | addLabel, removeLabel |
ComboboxEmpty | its children |
LanguagePicker | translations |
AssistProvider (@kanzo-tech/ai) | translations — every word an assisted field draws or announces |
Chat (@kanzo-tech/ai) | translations — the composer's placeholder and the error's announcement |
FieldRequiredIndicator | fallback |
Questionnaire buttons | their children |
Chat is short of that today, and it is a defect rather than a decision: the composer's button names
(Send, Stop, Retry), the reasoning fold's Thinking… and the tool frame's state labels are
English, and ChatTranslations does not reach them yet.
The host owns the words because it is the only place that knows the language, the register and the
product's own vocabulary — and because a catalogue inside a library is one more thing a product has
to keep in step with its own. Where the words are one phrase (LanguagePicker) they are an object
named translations, the way Ark's own machines take theirs; where they are one word, they are a
prop.
What would reverse it: a third product needing the same forty phrases translated the same way, which would make a shared catalogue cheaper than each host writing them.