surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.22k stars 816 forks source link

Selected dropdown value won't change with survey.locale #9034

Open jzju opened 2 weeks ago

jzju commented 2 weeks ago

Steps to reproduce

<SurveyComponent :model="survey"/>
import { Model } from "survey-core";
const survey = new Model({});

function onChange() {
  survey.locale = lang.value;
}

{
  "choices": [
      {
          "text": {
              "default": "english",
              "ne": "notenglish"
          },
          "value": "one"
      }
  ],
  "name": "q1",
  "title": {
      "default": "english",
      "ne": "notenglish"
  },
  "type": "dropdown"
}

Start with survey.locale = "ne", select option one, change survey.locale to "en", everything becomes english except the selected value in dropdown.

Expected behavior The dropdown should say english.

Screenshots Screenshot_20241111_171748

Please complete the following information:

JaneSjs commented 1 week ago

Hi @jzju, Please upgrade your SurveyJS Form Library to the latest v1.12.9. I tested the following demo and confirmed that a selected Dropdown value is updated correctly. View CodeSandbox

Let me know if this helps.

jzju commented 1 week ago

Screenshot_20241113_095902

Did you select the option before changein language?

jzju commented 1 week ago

Found a workaround to this and and another bug where rating where lacking text. Call survey.fromJSON after changing language.

survey.locale = lang.value;
survey.fromJSON(yourjson);
JaneSjs commented 1 week ago

Hello,

Did you select the option before changein language?

I tested the demo in various ways but did not reproduce any issues with improper translation. For me to move forward, I need to reproduce the issue on my end. Please share exact steps to reproduce the issue using the demo I shared earlier.

Thank you

and another bug where rating where lacking text. Call survey.fromJSON after changing language.

survey.locale = lang.value;
survey.fromJSON(yourjson);

I would also appreciate if you elaborate on this additional issue. Please share a relevant code/demo for research.

Thank you

jzju commented 1 week ago

This is from using your CodeSandbox

https://github.com/user-attachments/assets/98dd021d-189f-4d2e-bdbc-ff12ce114362