diff --git a/src/question_custom.ts b/src/question_custom.ts index 7948ae6684..09575844c6 100644 --- a/src/question_custom.ts +++ b/src/question_custom.ts @@ -414,8 +414,14 @@ export abstract class QuestionCustomModelBase extends Question this.getElement().locStrsChanged(); } } - protected createWrapper() { } - protected onPropertyValueChanged(name: string, oldValue: any, newValue: any) { + public localeChanged(): void { + super.locStrsChanged(); + if(!!this.getElement()) { + this.getElement().localeChanged(); + } + } + protected createWrapper(): void { } + protected onPropertyValueChanged(name: string, oldValue: any, newValue: any): void { super.onPropertyValueChanged(name, oldValue, newValue); if (!!this.customQuestion && !this.isLoadingFromJson) { this.customQuestion.onPropertyChanged(this, name, newValue); diff --git a/tests/question_customtests.ts b/tests/question_customtests.ts index a26bef7fc6..039c45cb4c 100644 --- a/tests/question_customtests.ts +++ b/tests/question_customtests.ts @@ -2545,3 +2545,23 @@ QUnit.test("Allow to add question via addNewQuestion for component, but not for assert.notOk(q3, "matrixdropdownbase is not created"); ComponentCollection.Instance.clear(); }); +QUnit.test("text placeholder is not updated on changing locale", function (assert) { + ComponentCollection.Instance.add({ + name: "customtext", + questionJSON: { + type: "text", + placeholder: { en: "en-TextPH", de: "de-TextPH" }, + }, + }); + const survey = new SurveyModel({ + elements: [ + { type: "customtext", name: "q1" } + ] + }); + const q1 = survey.getQuestionByName("q1"); + const contentQuestion = q1.contentQuestion; + assert.equal(contentQuestion.renderedPlaceholder, "en-TextPH", "en placeholder"); + survey.locale = "de"; + assert.equal(contentQuestion.renderedPlaceholder, "de-TextPH", "de placeholder"); + ComponentCollection.Instance.clear(); +});