Skip to content

Commit 090f229

Browse files
committed
Fix interface language
Signed-off-by: David Weik <[email protected]>
1 parent f65b21a commit 090f229

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Add: Deep-Linking support for Tabs
1010
- Change: SAS Logo for documentation - implementing [SAS logomark needs updating](https://github.com/sassoftware/sas-portal-framework-for-sas-viya/issues/7)
1111
- Add: Source code headers to include copyright and license information
12+
- Fix: Now when the local of the user isn't supported the Portal defaults to English
1213

1314
## SAS Portal Framework for SAS Viya v1.2.2
1415

js/utility/get-interface-language.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@
99
async function getInterfaceLanguage() {
1010
// Load a json based on the browser language
1111
const userLang = navigator.language || navigator.userLanguage;
12-
const textLanguageJSON = await fetch(
12+
let textLanguageJSON = await fetch(
1313
`./language/${userLang.substr(0, 2)}.json`
1414
);
15+
if (!textLanguageJSON.ok) {
16+
// ...fetch the default English file instead.
17+
console.log(`The UI is not available in your language: ${userLang.substr(0, 2)} - defaulting to English`);
18+
textLanguageJSON = await fetch('./language/en.json');
19+
}
1520
const textLanguageContent = await textLanguageJSON.json();
1621

1722
return textLanguageContent;

0 commit comments

Comments
 (0)