* Add Japanese locale (ja) support - New: ja.ts with 2624 UI translation keys - New: ja.settings.ts with 1789 settings translation keys - Registered ja in runtime.ts (Locale type, LOCALES, LOCALE_LABEL_KEYS, normalizeLocale) - Added ja-JP BCP-47 mapping in intl.ts - Added JA_MESSAGES in bootstrap.ts - Added ja to lazy-load dictionary map in store.ts - Updated messages.test.ts with ja dictionary - Added common.language.japanese to all 8 existing locale files * fix(i18n): complete Japanese locale updates * test(i18n): enforce locale key parity * docs: add Japanese documentation --------- Co-authored-by: yuchi0531 <yuchi0531@users.noreply.github.com> Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
20 lines
497 B
TypeScript
20 lines
497 B
TypeScript
import { useI18nStore } from './store';
|
|
import type { Locale } from './runtime';
|
|
|
|
const INTL_LOCALE_BY_LOCALE: Record<Locale, string> = {
|
|
en: 'en-US',
|
|
fr: 'fr-FR',
|
|
'zh-CN': 'zh-CN',
|
|
'zh-TW': 'zh-TW',
|
|
uk: 'uk-UA',
|
|
es: 'es-ES',
|
|
'pt-BR': 'pt-BR',
|
|
ko: 'ko-KR',
|
|
pl: 'pl-PL',
|
|
ja: 'ja-JP',
|
|
};
|
|
|
|
const getIntlLocale = (locale: Locale): string => INTL_LOCALE_BY_LOCALE[locale] ?? 'en-US';
|
|
|
|
export const getCurrentIntlLocale = (): string => getIntlLocale(useI18nStore.getState().locale);
|