mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 17:43:35 -06:00
* user essentials mob! 🔱 lastFile:public/locales/pseudo-LOCALE/grafana.json * user essentials mob! 🔱 * user essentials mob! 🔱 lastFile:contribute/internationalization.md * user essentials mob! 🔱 lastFile:contribute/internationalization.md * move pseudo generation to precommit hook if en-US file is modified Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com> Co-authored-by: tskarhed <1438972+tskarhed@users.noreply.github.com> * fix unit tests --------- Co-authored-by: Joao Silva <joao.silva@grafana.com> Co-authored-by: joshhunt <josh@trtr.co> Co-authored-by: Roxana Turc <anamaria-roxana.turc@grafana.com> Co-authored-by: eledobleefe <laura.fernandez@grafana.com> Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com> Co-authored-by: tskarhed <1438972+tskarhed@users.noreply.github.com>
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import { ResourceKey } from 'i18next';
|
|
|
|
export const ENGLISH_US = 'en-US';
|
|
export const FRENCH_FRANCE = 'fr-FR';
|
|
export const SPANISH_SPAIN = 'es-ES';
|
|
export const GERMAN_GERMANY = 'de-DE';
|
|
export const CHINESE_SIMPLIFIED = 'zh-Hans';
|
|
export const PSEUDO_LOCALE = 'pseudo-LOCALE';
|
|
|
|
export const DEFAULT_LANGUAGE = ENGLISH_US;
|
|
|
|
interface LanguageDefinitions {
|
|
/** 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>;
|
|
}
|
|
|
|
export const LANGUAGES: LanguageDefinitions[] = [
|
|
{
|
|
code: ENGLISH_US,
|
|
name: 'English',
|
|
loader: () => import('../../../locales/en-US/grafana.json'),
|
|
},
|
|
|
|
{
|
|
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'),
|
|
},
|
|
|
|
{
|
|
code: GERMAN_GERMANY,
|
|
name: 'Deutsch',
|
|
loader: () => import('../../../locales/de-DE/grafana.json'),
|
|
},
|
|
|
|
{
|
|
code: CHINESE_SIMPLIFIED,
|
|
name: '中文(简体)',
|
|
loader: () => import('../../../locales/zh-Hans/grafana.json'),
|
|
},
|
|
];
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
LANGUAGES.push({
|
|
code: PSEUDO_LOCALE,
|
|
name: 'Pseudo-locale',
|
|
loader: () => import('../../../locales/pseudo-LOCALE/grafana.json'),
|
|
});
|
|
}
|
|
|
|
export const VALID_LANGUAGES = LANGUAGES.map((v) => v.code);
|