Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

NIFIREG-326 - provide generic language fallback lookup if country-spe… #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
}

Expand Down