From ff6f2d13f99cae72c2ef06634212a854a4063afa Mon Sep 17 00:00:00 2001 From: Andrew Telnov Date: Tue, 2 Jan 2024 20:29:01 +0200 Subject: [PATCH] Changing the creator.locale doesn't translate toolbox items which appear in a More... popup form fix #5044 --- packages/survey-creator-core/src/toolbox.ts | 14 +++++++++----- .../tests/localization.tests.ts | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/survey-creator-core/src/toolbox.ts b/packages/survey-creator-core/src/toolbox.ts index 5162d0aaa9..5fab3b3868 100644 --- a/packages/survey-creator-core/src/toolbox.ts +++ b/packages/survey-creator-core/src/toolbox.ts @@ -466,13 +466,17 @@ export class QuestionToolbox } public updateTitles(): void { this.actions.forEach(action => { - const newTitle = editorLocalization.getString("qt." + action.name); - if (!!newTitle) { - action.title = newTitle; - action.tooltip = newTitle; - } + this.updateActionTitle(action); + this.updateActionTitle(action.innerItem); }); } + private updateActionTitle(action: IAction): void { + const newTitle = editorLocalization.getString("qt." + action.id); + if (!!newTitle) { + action.title = newTitle; + action.tooltip = newTitle; + } + } private updateCategoriesState() { var noActive = this.allowExpandMultipleCategories || this.keepAllCategoriesExpanded; if (noActive) { diff --git a/packages/survey-creator-core/tests/localization.tests.ts b/packages/survey-creator-core/tests/localization.tests.ts index d3e4fa0895..0dcbd886ec 100644 --- a/packages/survey-creator-core/tests/localization.tests.ts +++ b/packages/survey-creator-core/tests/localization.tests.ts @@ -182,6 +182,7 @@ test("Change Creator locale property", (): any => { expect(creator.propertyGrid.getQuestionByName("title").title).toEqual("Titel"); expect(tabButton.title).toEqual("Logik"); expect(textQuestion.title).toEqual("Text"); + expect(textQuestion.innerItem.title).toEqual("Text"); expect(saveAction.locTitle.text).toEqual("Umfrage speichern"); creator.selectElement(creator.survey.getQuestionByName("q2")); expect(creator.propertyGrid.getQuestionByName("format").title).toEqual("Format de"); @@ -191,6 +192,7 @@ test("Change Creator locale property", (): any => { expect(creator.propertyGrid.getQuestionByName("title").title).toEqual("Title"); expect(tabButton.title).toEqual("Logic"); expect(textQuestion.title).toEqual("Single-Line Input"); + expect(textQuestion.innerItem.title).toEqual("Single-Line Input"); expect(saveAction.title).toEqual("Save Survey"); }); test("Check creator license localization", (): any => {