Skip to content

Commit

Permalink
Translation Tab - The All Strings / Used Strings Only dropdown items …
Browse files Browse the repository at this point in the history
…appear untranslated when switching the UI locale at runtime fix #5490
  • Loading branch information
andrewtelnov committed May 14, 2024
1 parent b39e789 commit 6315cba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class TabTranslationPlugin implements ICreatorPlugin {
visible: false,
mode: "small",
}, {
items: [{ id: "show-all-strings", title: this.showAllStringsText }, { id: "show-used-strings-only", title: this.showUsedStringsOnlyText }],
items: [{ id: "show-all-strings", locTitleName: "ed.translationShowAllStrings" }, { id: "show-used-strings-only", locTitleName: "ed.translationShowUsedStringsOnly" }],
allowSelection: true,
onSelectionChanged: (item: IAction) => {
this.model.showAllStrings = item.id === "show-all-strings";
Expand Down
24 changes: 24 additions & 0 deletions packages/survey-creator-core/tests/tabs/translation.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2052,3 +2052,27 @@ test("Store locales order", () => {
expect(visChoices2[2]).toEqual("es");
expect(visChoices2[3]).toEqual("de");
});
test("Change test themes list actions titles on changing locale", (): any => {
const deutschStrings: any = {
ed: {
translationShowAllStrings: "Show All de",
translationShowUsedStringsOnly: "Used Strings Only de"
}
};
editorLocalization.locales["de"] = deutschStrings;
const creator = new CreatorTester({ showTranslationTab: true });
const dropdownAction = creator.getActionBarItem("svc-translation-show-all-strings");
expect(dropdownAction).toBeTruthy();
expect(dropdownAction.visible).toBeFalsy();
const listModel = <ListModel>dropdownAction.popupModel.contentComponentData.model;
const actions = listModel.actions;
expect(actions).toHaveLength(2);
expect(actions[0].title).toBe("All Strings");
expect(actions[1].title).toBe("Used Strings Only");
creator.locale = "de";
creator.activeTab = "translation";
expect(dropdownAction.visible).toBeTruthy();
expect(actions).toHaveLength(2);
expect(actions[0].title).toBe("Show All de");
expect(actions[1].title).toBe("Used Strings Only de");
});

0 comments on commit 6315cba

Please sign in to comment.