0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

Update docusaurus.config.js

This commit is contained in:
Juan Picado 2024-08-06 19:49:23 +02:00
parent 97947ebb3d
commit c63655b6f2

View file

@ -18,7 +18,7 @@ const lgnMapping = {
const progress = translations; const progress = translations;
const limitLngIncluded = 80; const limitLngIncluded = 80;
console.log('limit translation is on %s%', limitLngIncluded); console.log('limit translation is on %s%', limitLngIncluded);
const isDeployPreview = process.env.CONTEXT === 'deploy-preview';
const isProductionDeployment = process.env.CONTEXT === 'production'; const isProductionDeployment = process.env.CONTEXT === 'production';
const filterByProgress = (items) => { const filterByProgress = (items) => {
const originLng = Object.keys(translations); const originLng = Object.keys(translations);
@ -32,7 +32,9 @@ const filterByProgress = (items) => {
return false; return false;
} }
if (translations[_lgn].approvalProgress <= limitLngIncluded) { // console.log('_lgn', _lgn);
// console.log('translations---->', translations[_lgn]);
if (translations[_lgn].translationProgress <= limitLngIncluded) {
console.log( console.log(
'language %s is being excluded due does not met limit of translation, current: %s%', 'language %s is being excluded due does not met limit of translation, current: %s%',
_lgn, _lgn,
@ -45,27 +47,29 @@ const filterByProgress = (items) => {
}); });
}; };
const locales = filterByProgress([
'en',
'cs-CZ',
'de-DE',
'es-ES',
'fr-FR',
'it-IT',
'ga-IE',
'pl-PL',
'pt-BR',
'ru-RU',
'sr-CS',
'vi-VN',
'yo-NG',
'zh-TW',
'zh-CN',
]);
console.log('locales', locales);
const i18nConfig = { const i18nConfig = {
defaultLocale: 'en', defaultLocale: 'en',
locales: isDeployPreview locales,
? ['en']
: filterByProgress([
'en',
'cs-CZ',
'de-DE',
'es-ES',
'fr-FR',
'it-IT',
'ga-IE',
'pl-PL',
'pt-BR',
'ru-RU',
'sr-CS',
'vi-VN',
'yo-NG',
'zh-TW',
'zh-CN',
]),
localeConfigs: { localeConfigs: {
en: { label: 'English' }, en: { label: 'English' },
'it-IT': { label: `Italiano (${progress['it'].translationProgress}%)` }, 'it-IT': { label: `Italiano (${progress['it'].translationProgress}%)` },