2022-10-21 04:29:03 -05:00
|
|
|
import { ResourceKey } from 'i18next';
|
|
|
|
|
2022-08-26 04:27:14 -05:00
|
|
|
export const ENGLISH_US = 'en-US';
|
|
|
|
export const FRENCH_FRANCE = 'fr-FR';
|
|
|
|
export const SPANISH_SPAIN = 'es-ES';
|
2022-10-21 05:47:17 -05:00
|
|
|
export const GERMAN_GERMANY = 'de-DE';
|
2022-10-12 05:12:46 -05:00
|
|
|
export const CHINESE_SIMPLIFIED = 'zh-Hans';
|
2022-10-06 10:34:04 -05:00
|
|
|
export const PSEUDO_LOCALE = 'pseudo-LOCALE';
|
2022-07-22 09:50:00 -05:00
|
|
|
|
2022-11-22 06:18:34 -06:00
|
|
|
export const DEFAULT_LANGUAGE = ENGLISH_US;
|
2022-07-22 09:50:00 -05:00
|
|
|
|
2022-11-22 06:18:34 -06:00
|
|
|
interface LanguageDefinitions {
|
2022-10-21 04:29:03 -05:00
|
|
|
/** IETF language tag for the language e.g. en-US */
|
|
|
|
code: string;
|
|
|
|
|
|
|
|
/** Language name to show in the UI. Should be formatted local to that language e.g. Français for French */
|
|
|
|
name: string;
|
|
|
|
|
|
|
|
/** Function to load translations */
|
|
|
|
loader: () => Promise<ResourceKey>;
|
|
|
|
}
|
|
|
|
|
2022-11-22 06:18:34 -06:00
|
|
|
export const LANGUAGES: LanguageDefinitions[] = [
|
2022-10-21 04:29:03 -05:00
|
|
|
{
|
|
|
|
code: ENGLISH_US,
|
|
|
|
name: 'English',
|
2023-07-11 10:37:01 -05:00
|
|
|
loader: () => import('../../../locales/en-US/grafana.json'),
|
2022-10-21 04:29:03 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
code: FRENCH_FRANCE,
|
|
|
|
name: 'Français',
|
|
|
|
loader: () => import('../../../locales/fr-FR/grafana.json'),
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
code: SPANISH_SPAIN,
|
|
|
|
name: 'Español',
|
|
|
|
loader: () => import('../../../locales/es-ES/grafana.json'),
|
|
|
|
},
|
|
|
|
|
2022-10-21 05:47:17 -05:00
|
|
|
{
|
|
|
|
code: GERMAN_GERMANY,
|
|
|
|
name: 'Deutsch',
|
|
|
|
loader: () => import('../../../locales/de-DE/grafana.json'),
|
|
|
|
},
|
|
|
|
|
2022-10-21 04:29:03 -05:00
|
|
|
{
|
|
|
|
code: CHINESE_SIMPLIFIED,
|
|
|
|
name: '中文(简体)',
|
|
|
|
loader: () => import('../../../locales/zh-Hans/grafana.json'),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
2022-11-22 06:18:34 -06:00
|
|
|
LANGUAGES.push({
|
2022-10-21 04:29:03 -05:00
|
|
|
code: PSEUDO_LOCALE,
|
|
|
|
name: 'Pseudo-locale',
|
|
|
|
loader: () => import('../../../locales/pseudo-LOCALE/grafana.json'),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-11-22 06:18:34 -06:00
|
|
|
export const VALID_LANGUAGES = LANGUAGES.map((v) => v.code);
|