mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01:00
26 lines
718 B
JavaScript
26 lines
718 B
JavaScript
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;
|
|
|
|
const locales = [
|
|
DEFAULT_LANG,
|
|
...catalogs
|
|
.filter(({ completion }) => completion >= PERCENTAGE_THRESHOLD)
|
|
.map(({ code }) => code),
|
|
];
|
|
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];
|