Skip to content

Commit

Permalink
languages: fix languages prompts (#28035)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Nov 29, 2024
1 parent f2b7134 commit c6fe9ac
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions generators/languages/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export async function askForLanguages(this: LanguagesGenerator, { control }) {
const currentLanguages = this.jhipsterConfig.languages ?? [];
const answers = await this.prompt([
{
when: this.jhipsterConfigWithDefaults.enableTranslation,
type: 'checkbox',
name: 'languages',
message: 'Please choose additional languages to install',
Expand All @@ -67,9 +68,11 @@ export async function askForLanguages(this: LanguagesGenerator, { control }) {
default: () => this.jhipsterConfigWithDefaults.languages,
},
]);
if (control.existingProject) {
this.languagesToApply.push(...answers.languages.filter(newLang => !currentLanguages.includes(newLang)));
} else {
this.languagesToApply.push(...answers.languages);
if (answers.languages) {
if (control.existingProject) {
this.languagesToApply.push(...answers.languages.filter(newLang => !currentLanguages.includes(newLang)));
} else {
this.languagesToApply.push(...answers.languages);
}
}
}

0 comments on commit c6fe9ac

Please sign in to comment.