Question T11480
Visible to All Users

Remove localized strings from survey JSON

created 2 years ago

Dear support desk,

After updating Survey.surveyLocalization.supportedLocales I want to remove any unsupported languages from the survey json in order for the viewer method getUsedLocales to return the correct languages.

I'm using a script like attached.

Is this the best way or can you recommend a better approach?

Answers approved by surveyjs Support

created 2 years ago

Hello Bas,
The easy way is to use the Creator Translation class. You can use a non-ui version of it. Here is the example. It is in react version, but I believe you will be able to repeat this code for any platform.

PS: This ticket doesn't contain any private information. You can make it public to let other developers to benefit from it.

Thank you,
Andrew
SurveyJS Team

    Comments (2)
    BS BS
    Bas Schiltmans 2 years ago

      The recommended solution works in V2, but raises an an error in V1 knockout.

      Clipboard-File-1.png

      Please check on https://codesandbox.io/s/focused-waterfall-w0vopo?file=/src/index.js:120-152

      Changing the survey mode property from edit to display (or vice versa) will trigger the code in index.js lines 25-32

      Could you let me know how I can resolve this?

        Hello,

        I created a separate ticket on your behalf: T11508: Remove localized strings (Survey Creator V1). We placed it in our processing queue and will process it shortly.