[NIFI-9623] - Attempt to look up messages locale file without country designation if it fails to find it with the country designation

Signed-off-by: Nathan Gough <thenatog@gmail.com>

This closes #5707.
This commit is contained in:
Rob Fellows 2022-01-24 13:43:23 -05:00 committed by Nathan Gough
parent ce66cf41e2
commit 8d143e8367
1 changed files with 21 additions and 1 deletions

View File

@ -60,7 +60,27 @@ if (!locale || locale === 'en-us') {
}
bootstrapModule();
}).fail(function () {
bootstrapModule();
// was this a country specific locale? if so, try to get the generic version of the language
const localeTokens = locale.split('-');
if (localeTokens.length === 2) {
translationFile = 'locale/messages.' + localeTokens[0] + '.xlf';
$.ajax({
url: translationFile,
dataType: 'text'
}).done(function (translations) {
// add providers if translation file for locale is loaded
if (translations) {
providers.push({provide: TRANSLATIONS, useValue: translations});
providers.push({provide: TRANSLATIONS_FORMAT, useValue: 'xlf'});
providers.push({provide: LOCALE_ID, useValue: localeTokens[0]});
}
bootstrapModule();
}).fail(function () {
bootstrapModule();
});
} else {
bootstrapModule();
}
});
}