Hello everyone,
Is it possible to define a generic custom string in .ds files and use it dynamically in the survey to retrieve the appropriate translated text ?
Example :
./localization/english.ds
TypeScriptimport { surveyLocalization } from "../surveyStrings";
export var englishSurveyStrings = {
customString: "This string is in english";
};
surveyLocalization.locales["en"] = englishSurveyStrings;
surveyLocalization.localeNames["en"]="english";
./localization/french.ds
TypeScriptimport { surveyLocalization } from "../surveyStrings";
export var frenchSurveyStrings = {
customString: "Cette chaine de caractères est en français";
};
surveyLocalization.locales["fr"] = frenchSurveyStrings;
surveyLocalization.localeNames["fr"]="français";
survey.jquery.d.ts
TypeScriptimport "./localization/french";
import "./localization/english";
Survey.js
JavaScriptvar jsonSurvey = {
title: customString;
pages: [{ ... }]
}
This way if my customString is used multiple times in my survey and I need to change the translation I only need to change it one time in the .ds files.
Hello,
SurveyJS doesn't support such a feature for survey JSON.
Thanks, Serge
SurveyJS Team
Hello Serge T,
Thanks for your quick feedback.
Is it something that would be available some point in near future ?
Because sometimes we have to repeat some elements in our surveys and this feature would help to avoid repeating the texts in the JSON file.
Regards,