Skip to content

Commit

Permalink
Merge pull request #290 from YaswanthNagarjuna/ES-162
Browse files Browse the repository at this point in the history
[ES-162] default language for dropdown is corrected
  • Loading branch information
anshulv1401 authored Jul 27, 2023
2 parents 10633e5 + 3a65d81 commit 7e0fc84
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion oidc-ui/src/components/NavHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ export default function NavHeader({ langOptions, i18nKeyPrefix = "header" }) {
let lang = langOptions.find((option) => {
return option.value === i18n.language;
});
setSelectedLang(lang);

if (lang == null) {
const defaultLanguageCode = window["envConfigs"].defaultLang;

// Find the language option that matches the extracted language code
const defaultLang = langOptions.find((option) => option.value === defaultLanguageCode);
setSelectedLang(defaultLang);
} else {
setSelectedLang(lang);
}

//Gets fired when changeLanguage got called.
i18n.on("languageChanged", function (lng) {
Expand Down

0 comments on commit 7e0fc84

Please sign in to comment.