diff --git a/src/LanguageSelector/index.jsx b/src/LanguageSelector/index.jsx
index 0ef32080b..5c000c60d 100644
--- a/src/LanguageSelector/index.jsx
+++ b/src/LanguageSelector/index.jsx
@@ -25,8 +25,14 @@ const onLanguageSelected = async (username, selectedLanguageCode) => {
};
const LanguageSelector = ({
- intl, options, authenticatedUser, ...props
+ intl, options, authenticatedUser, compact, ...props
}) => {
+
+ const languageLabel = (languageCode) => {
+ const option = options.find( ({ value, label }) => value === languageCode )
+ return option ? option.label : null
+ }
+
const handleChange = (languageCode, event) => {
const previousSiteLanguage = getLocale();
console.debug(previousSiteLanguage, languageCode, authenticatedUser);
@@ -34,21 +40,43 @@ const LanguageSelector = ({
if (previousSiteLanguage !== languageCode) {
onLanguageSelected(authenticatedUser?.username, languageCode);
}
+
+ event.target.parentElement.parentElement.querySelector(".languageLabel").innerHTML = languageLabel(languageCode);
};
+ const currentLangLabel = languageLabel(intl.locale)
+ const showLabel = !Boolean(compact || false);
+
return (
-