Skip to content

Commit

Permalink
Update setupLocale function (#9170)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov authored Dec 16, 2024
1 parent c6e48db commit 0e41b87
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/survey-core/src/surveyStrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ export var surveyLocalization = {
//TODO remove on next week
get showNamesInEnglish(): boolean { return this.useEnglishNames; },
set showNamesInEnglish(val: boolean) { this.useEnglishNames = val; },
setupLocale(loc: string, strings: any, name: string, nameInEngish: string, direction?: string): void {
this.locales[loc] = strings;
this.localeNames[loc] = name;
this.localeNamesInEnglish[loc] = nameInEngish;
if (direction !== undefined) {
this.localeDirections[loc] = direction;
setupLocale(localeConfig: { localeCode: string, strings: any, nativeName: string, englishName: string, rtl?: boolean }): void {
const loc = localeConfig.localeCode;
this.locales[loc] = localeConfig.strings;
this.localeNames[loc] = localeConfig.nativeName;
this.localeNamesInEnglish[loc] = localeConfig.englishName;
if (localeConfig.rtl !== undefined) {
this.localeDirections[loc] = localeConfig.rtl;
}
},
get currentLocale(): string {
Expand Down Expand Up @@ -102,7 +103,7 @@ export function getLocaleString(strName: string, locale: string = null): string
return surveyLocalization.getString(strName, locale);
}
export function setupLocale(localeConfig: { localeCode: string, strings: any, nativeName: string, englishName: string, rtl?: boolean }): void {
surveyLocalization.setupLocale(localeConfig.localeCode, localeConfig.strings, localeConfig.nativeName, localeConfig.englishName, localeConfig.rtl ? "rtl" : undefined);
surveyLocalization.setupLocale(localeConfig);
}
export var surveyStrings = englishStrings;
(<any>surveyLocalization).locales["en"] = englishStrings;
Expand Down

0 comments on commit 0e41b87

Please sign in to comment.