Update available languages
This commit is contained in:
@@ -9,13 +9,30 @@
|
|||||||
import { defineConfig } from '@lingui/cli';
|
import { defineConfig } from '@lingui/cli';
|
||||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
import { formatter } from '@lingui/format-po';
|
import { formatter } from '@lingui/format-po';
|
||||||
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
||||||
import localesConfig from './src/i18n/locales.json';
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
sourceLocale: localesConfig.defaultLocale,
|
sourceLocale: 'en',
|
||||||
locales: localesConfig.locales,
|
// This array is auto-generated by tools/scripts/weblate/generatei18nResources.ts. Do not edit manually.
|
||||||
|
locales: [
|
||||||
|
'de',
|
||||||
|
'en',
|
||||||
|
'es',
|
||||||
|
'fa',
|
||||||
|
'fr',
|
||||||
|
'hu',
|
||||||
|
'it',
|
||||||
|
'ja',
|
||||||
|
'ko',
|
||||||
|
'pl',
|
||||||
|
'pt',
|
||||||
|
'ru',
|
||||||
|
'ta',
|
||||||
|
'tr',
|
||||||
|
'vi',
|
||||||
|
'zh_Hans',
|
||||||
|
'zh_Hant',
|
||||||
|
],
|
||||||
catalogs: [
|
catalogs: [
|
||||||
{
|
{
|
||||||
path: '<rootDir>/src/i18n/locales/{locale}',
|
path: '<rootDir>/src/i18n/locales/{locale}',
|
||||||
|
|||||||
@@ -8,14 +8,32 @@
|
|||||||
|
|
||||||
import { i18n } from '@lingui/core';
|
import { i18n } from '@lingui/core';
|
||||||
import { detectLocale, SELECTED_LANGUAGE_CODE_KEY } from '@/lib/ISOLanguageUtil.ts';
|
import { detectLocale, SELECTED_LANGUAGE_CODE_KEY } from '@/lib/ISOLanguageUtil.ts';
|
||||||
import localesConfig from '@/i18n/locales.json';
|
|
||||||
import { AppStorage } from '@/lib/storage/AppStorage.ts';
|
import { AppStorage } from '@/lib/storage/AppStorage.ts';
|
||||||
|
|
||||||
export const i18nResources = localesConfig.locales;
|
// This array is auto-generated by tools/scripts/weblate/generatei18nResources.ts. Do not edit manually.
|
||||||
|
export const i18nResources = [
|
||||||
|
'de',
|
||||||
|
'en',
|
||||||
|
'es',
|
||||||
|
'fa',
|
||||||
|
'fr',
|
||||||
|
'hu',
|
||||||
|
'it',
|
||||||
|
'ja',
|
||||||
|
'ko',
|
||||||
|
'pl',
|
||||||
|
'pt',
|
||||||
|
'ru',
|
||||||
|
'ta',
|
||||||
|
'tr',
|
||||||
|
'vi',
|
||||||
|
'zh_Hans',
|
||||||
|
'zh_Hant',
|
||||||
|
] as const;
|
||||||
|
|
||||||
export type I18nResourceCode = (typeof i18nResources)[number];
|
export type I18nResourceCode = (typeof i18nResources)[number];
|
||||||
|
|
||||||
const DEFAULT_LOCALE = localesConfig.defaultLocale;
|
const DEFAULT_LOCALE = 'en';
|
||||||
|
|
||||||
export async function loadCatalog(locale: string): Promise<void> {
|
export async function loadCatalog(locale: string): Promise<void> {
|
||||||
const localeToLoad = i18nResources.includes(locale as (typeof i18nResources)[number]) ? locale : DEFAULT_LOCALE;
|
const localeToLoad = i18nResources.includes(locale as (typeof i18nResources)[number]) ? locale : DEFAULT_LOCALE;
|
||||||
|
|||||||
Reference in New Issue
Block a user