Skip to content

Commit c6fe9ac

Browse files
authored
languages: fix languages prompts (#28035)
1 parent f2b7134 commit c6fe9ac

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

generators/languages/prompts.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export async function askForLanguages(this: LanguagesGenerator, { control }) {
5454
const currentLanguages = this.jhipsterConfig.languages ?? [];
5555
const answers = await this.prompt([
5656
{
57+
when: this.jhipsterConfigWithDefaults.enableTranslation,
5758
type: 'checkbox',
5859
name: 'languages',
5960
message: 'Please choose additional languages to install',
@@ -67,9 +68,11 @@ export async function askForLanguages(this: LanguagesGenerator, { control }) {
6768
default: () => this.jhipsterConfigWithDefaults.languages,
6869
},
6970
]);
70-
if (control.existingProject) {
71-
this.languagesToApply.push(...answers.languages.filter(newLang => !currentLanguages.includes(newLang)));
72-
} else {
73-
this.languagesToApply.push(...answers.languages);
71+
if (answers.languages) {
72+
if (control.existingProject) {
73+
this.languagesToApply.push(...answers.languages.filter(newLang => !currentLanguages.includes(newLang)));
74+
} else {
75+
this.languagesToApply.push(...answers.languages);
76+
}
7477
}
7578
}

0 commit comments

Comments
 (0)