smoonb 0.0.78 → 0.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/i18n/locales/en.json
CHANGED
|
@@ -266,6 +266,7 @@
|
|
|
266
266
|
"env.language.english": "English",
|
|
267
267
|
"env.language.portuguese": "Portuguese (pt-BR)",
|
|
268
268
|
"env.language.saved": "Default language saved: {lang}",
|
|
269
|
+
"env.language.applied": "Language applied! The next messages will be displayed in the selected language.",
|
|
269
270
|
|
|
270
271
|
"backup.components.edgeFunctions.title": "Edge Functions:",
|
|
271
272
|
"backup.components.edgeFunctions.description1": "We will delete existing functions in the supabase/functions folder, reset the link",
|
|
@@ -266,6 +266,7 @@
|
|
|
266
266
|
"env.language.english": "Inglês (English)",
|
|
267
267
|
"env.language.portuguese": "Português (pt-BR)",
|
|
268
268
|
"env.language.saved": "Idioma padrão salvo: {lang}",
|
|
269
|
+
"env.language.applied": "Idioma aplicado! As próximas mensagens serão exibidas no idioma selecionado.",
|
|
269
270
|
|
|
270
271
|
"backup.components.edgeFunctions.title": "Edge Functions:",
|
|
271
272
|
"backup.components.edgeFunctions.description1": "Vamos apagar as funções existentes na pasta supabase/functions, fazer um reset no link",
|
|
@@ -206,33 +206,43 @@ async function mapEnvVariablesInteractively(env, expectedKeys) {
|
|
|
206
206
|
throw new Error(`Duplicidade de mapeamento detectada para ${clientKey}`);
|
|
207
207
|
}
|
|
208
208
|
dePara[clientKey] = expected;
|
|
209
|
+
}
|
|
209
210
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
211
|
+
// Após processar todas as variáveis, perguntar sobre idioma padrão se SMOONB_OUTPUT_DIR foi processado
|
|
212
|
+
const outputDirProcessed = Object.values(dePara).includes('SMOONB_OUTPUT_DIR');
|
|
213
|
+
if (outputDirProcessed) {
|
|
214
|
+
const currentLang = finalEnv.SMOONB_LANG || '';
|
|
215
|
+
const { normalizeLocale } = require('../i18n');
|
|
216
|
+
|
|
217
|
+
const langChoices = [
|
|
218
|
+
{ name: getT('env.language.english'), value: 'en' },
|
|
219
|
+
{ name: getT('env.language.portuguese'), value: 'pt-BR' }
|
|
220
|
+
];
|
|
219
221
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
const defaultLang = currentLang ? normalizeLocale(currentLang) || 'en' : 'en';
|
|
223
|
+
const defaultIndex = langChoices.findIndex(c => c.value === defaultLang);
|
|
222
224
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
225
|
+
const { selectedLang } = await inquirer.prompt([{
|
|
226
|
+
type: 'list',
|
|
227
|
+
name: 'selectedLang',
|
|
228
|
+
message: getT('env.language.selectDefault'),
|
|
229
|
+
choices: langChoices,
|
|
230
|
+
default: defaultIndex >= 0 ? defaultIndex : 0,
|
|
231
|
+
loop: false,
|
|
232
|
+
prefix: ''
|
|
233
|
+
}]);
|
|
232
234
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
finalEnv.SMOONB_LANG = selectedLang;
|
|
236
|
+
|
|
237
|
+
// Re-inicializar i18n com o novo idioma para aplicar mudança em tempo real
|
|
238
|
+
const { initI18n } = require('../i18n');
|
|
239
|
+
const newI18n = initI18n(process.argv, { ...process.env, SMOONB_LANG: selectedLang });
|
|
240
|
+
Object.assign(global.smoonbI18n, newI18n);
|
|
241
|
+
|
|
242
|
+
// Atualizar getT para usar o novo idioma
|
|
243
|
+
const getT = global.smoonbI18n?.t || t;
|
|
244
|
+
console.log(chalk.green(`✅ ${getT('env.language.saved', { lang: selectedLang })}`));
|
|
245
|
+
console.log(chalk.cyan(`🌐 ${getT('env.language.applied')}`));
|
|
236
246
|
}
|
|
237
247
|
|
|
238
248
|
return { finalEnv, dePara };
|