Foundations
Languages and words
The components say a few words themselves: the name of a close button, “Copied”, “No results”. These are keyed words in English, Serbian Latin and Cyrillic, Swedish, German, French, Italian, Portuguese and Chinese, chosen by the lang of the page or of the element.
Examples
The same component in three languages
Each number field below names its buttons in its own language.
HTML
<div class="kui-grid kui-grid--sm">
<div class="kui-field" lang="sr-Latn"><label class="kui-label" for="w-1">Broj gostiju</label><kui-number><input class="kui-input" id="w-1" type="number" min="1" max="12" value="2"></kui-number></div>
<div class="kui-field" lang="de"><label class="kui-label" for="w-2">Anzahl der Gäste</label><kui-number><input class="kui-input" id="w-2" type="number" min="1" max="12" value="2"></kui-number></div>
<div class="kui-field" lang="zh"><label class="kui-label" for="w-3">客人数量</label><kui-number><input class="kui-input" id="w-3" type="number" min="1" max="12" value="2"></kui-number></div>
</div>
Classes and attributes
lang="sr-Latn" | "sr-Cyrl" | "sr" | "en" | "sv" | "de" | "fr" | "it" | "pt" | "zh"- The language of the page or a part of it. sr alone means Serbian in Latin script.
kui.setWords(lang, { key: text })- Adds or replaces words, for a new language or a product’s own wording.
kui.t(key, values)- Reads a word, with {name} filled in.
kui.words- Every keyed word of the kit, by language.
Dates and numbers- Calendars, charts and file sizes use Intl with the element’s language; no month or day names are written in the kit.
Accessibility
- Set lang on the html element; screen readers choose their voice from it.
Do and do not
Do
- Keep a product’s own interface text in a words file per language (the product starter has one).
Do not
- Do not write interface text into a component’s code.