phanpy/src/locales.js

27 lines
718 B
JavaScript
Raw Normal View History

import catalogs from './data/catalogs.json';
export const DEFAULT_LANG = 'en';
export const CATALOGS = catalogs;
// Get locales that's >= X% translated
const PERCENTAGE_THRESHOLD = 50;
2024-08-17 05:47:46 +02:00
const locales = [
DEFAULT_LANG,
...catalogs
.filter(({ completion }) => completion >= PERCENTAGE_THRESHOLD)
.map(({ code }) => code),
2024-08-17 05:47:46 +02:00
];
export const LOCALES = locales;
let devLocales = [];
if (import.meta.env?.DEV || import.meta.env?.PHANPY_SHOW_DEV_LOCALES) {
devLocales = catalogs
.filter(({ completion }) => completion < PERCENTAGE_THRESHOLD)
.map(({ code }) => code);
devLocales.push('pseudo-LOCALE');
}
export const DEV_LOCALES = devLocales;
export const ALL_LOCALES = [...locales, ...devLocales];