@salmonui/locales
v0.4.2
Published
Locale packs for Salmon UI: the text of every component family, one tree-shakable entry per CLDR locale.
Readme
@salmonui/locales
Locale packs for Salmon UI: the text of every component family, one tree-shakable entry per CLDR locale.
npm install @salmonui/core @salmonui/localesPass a pack to the LocaleProvider of @salmonui/core:
import { LocaleProvider } from '@salmonui/core/locale';
import { zhHant } from '@salmonui/locales/zh-Hant';
<LocaleProvider locale="zh-Hant" localeText={zhHant}>
<App />
</LocaleProvider>;- One entry per locale,
@salmonui/locales/<tag>, with the BCP 47 tag of a Unicode CLDR locale, such aszh-Hansorzh-Hant, for the languages CLDR rates as modern and their regional locales. A locale has an entry once its translation, or the one it shares, is complete. - Each entry exports the whole catalog (
zhHant,en,zhHans, ...), every family by name (pager,dataGrid, ...) and its tag aslocale. Bundlers keep only the families you import. - Plain data: no dependencies, no React, no DOM. ESM only,
sideEffects: false. - Only the packs are public; other files of the package are not.
To change some strings, check an object with satisfies StrictLocaleCatalog
(from @salmonui/core/locale) and pass it to a nested provider. To write a
complete pack of your own, check it with the type of a pack:
import type { LocalePack } from '@salmonui/locales/en';
export const myPack = {
// every family with every key
} satisfies LocalePack;See the locale provider guide for details.
Every @salmonui/* package of an application must resolve to the same
version (they are released together).
License
MIT. Which packs share their text is derived from Unicode CLDR data; see THIRD_PARTY_LICENSES.md.
