2024-08-19 04:52:56 +02:00
|
|
|
import catalogs from './data/catalogs.json';
|
|
|
|
|
2024-08-14 11:16:56 +02:00
|
|
|
export const DEFAULT_LANG = 'en';
|
2024-08-19 04:52:56 +02:00
|
|
|
export const CATALOGS = catalogs;
|
|
|
|
|
|
|
|
// Get locales that's >= X% translated
|
|
|
|
const PERCENTAGE_THRESHOLD = 50;
|
2024-08-14 11:16:56 +02:00
|
|
|
|
2024-08-17 05:47:46 +02:00
|
|
|
const locales = [
|
|
|
|
DEFAULT_LANG,
|
2024-08-19 04:52:56 +02:00
|
|
|
...catalogs
|
|
|
|
.filter(({ completion }) => completion >= PERCENTAGE_THRESHOLD)
|
|
|
|
.map(({ code }) => code),
|
2024-08-17 05:47:46 +02:00
|
|
|
];
|
2024-08-14 11:16:56 +02:00
|
|
|
export const LOCALES = locales;
|
2024-08-21 18:12:47 +02:00
|
|
|
|
|
|
|
let devLocales = [];
|
2024-08-24 10:36:52 +02:00
|
|
|
if (import.meta.env?.DEV || import.meta.env?.PHANPY_SHOW_DEV_LOCALES) {
|
2024-08-21 18:12:47 +02:00
|
|
|
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];
|