59 lines
2.1 KiB
TypeScript
59 lines
2.1 KiB
TypeScript
/**
|
|
* Ordered list of built-in supported locale codes shipped with the
|
|
* Suaveplan i18n family. The order is the canonical default order
|
|
* used by the locale detector when no caller-supplied preference list
|
|
* is available.
|
|
*/
|
|
export const DEFAULT_LOCALES = [
|
|
"en",
|
|
"es",
|
|
"fr",
|
|
"de",
|
|
"cy",
|
|
"zh",
|
|
"ar",
|
|
"ru",
|
|
"pl",
|
|
"ja",
|
|
"ko",
|
|
"pt",
|
|
"it",
|
|
"nl",
|
|
"he",
|
|
"fa",
|
|
] as const;
|
|
|
|
/** String-literal union of every code in {@link DEFAULT_LOCALES}. */
|
|
export type DefaultLocale = (typeof DEFAULT_LOCALES)[number];
|
|
|
|
/**
|
|
* Per-locale display metadata: English `name`, locale-native
|
|
* `nativeName`, and the canonical text `direction`.
|
|
*
|
|
* Every entry in {@link DEFAULT_LOCALES} has a corresponding
|
|
* descriptor here. The `direction` field SHALL agree with the
|
|
* locale's membership in `RTL_LOCALES` — a unit test asserts the
|
|
* cross-file invariant.
|
|
*/
|
|
export const LOCALE_DESCRIPTORS: Record<
|
|
string,
|
|
{ name: string; nativeName: string; direction: "ltr" | "rtl" }
|
|
> = {
|
|
en: { name: "English", nativeName: "English", direction: "ltr" },
|
|
es: { name: "Spanish", nativeName: "Español", direction: "ltr" },
|
|
fr: { name: "French", nativeName: "Français", direction: "ltr" },
|
|
de: { name: "German", nativeName: "Deutsch", direction: "ltr" },
|
|
cy: { name: "Welsh", nativeName: "Cymraeg", direction: "ltr" },
|
|
zh: { name: "Chinese", nativeName: "中文", direction: "ltr" },
|
|
ar: { name: "Arabic", nativeName: "العربية", direction: "rtl" },
|
|
ru: { name: "Russian", nativeName: "Русский", direction: "ltr" },
|
|
pl: { name: "Polish", nativeName: "Polski", direction: "ltr" },
|
|
ja: { name: "Japanese", nativeName: "日本語", direction: "ltr" },
|
|
ko: { name: "Korean", nativeName: "한국어", direction: "ltr" },
|
|
pt: { name: "Portuguese", nativeName: "Português", direction: "ltr" },
|
|
it: { name: "Italian", nativeName: "Italiano", direction: "ltr" },
|
|
nl: { name: "Dutch", nativeName: "Nederlands", direction: "ltr" },
|
|
he: { name: "Hebrew", nativeName: "עברית", direction: "rtl" },
|
|
fa: { name: "Persian", nativeName: "فارسی", direction: "rtl" },
|
|
};
|