Fix bugs with language switch #85
This commit is contained in:
parent
6ccf72c707
commit
d54586426a
@ -62,17 +62,23 @@ export const Template = memo((props: TemplateProps) => {
|
|||||||
const { realm, locale, auth, url, message, isAppInitiatedAction } = kcContext;
|
const { realm, locale, auth, url, message, isAppInitiatedAction } = kcContext;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!realm.internationalizationEnabled || kcContext.pageId === "error.ftl") {
|
if (!realm.internationalizationEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(locale !== undefined);
|
assert(locale !== undefined);
|
||||||
|
|
||||||
if (kcLanguageTag === getBestMatchAmongKcLanguageTag(locale.current)) {
|
const kcContext_kcLanguageTag = getBestMatchAmongKcLanguageTag(locale.current);
|
||||||
|
|
||||||
|
if (["error.ftl", "info.ftl", "login-page-expired.ftl"].indexOf(kcContext.pageId) >= 0) {
|
||||||
|
setKcLanguageTag(kcContext_kcLanguageTag);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.location.href = locale.supported.find(({ languageTag }) => languageTag === kcLanguageTag)!.url;
|
if (kcLanguageTag !== kcContext_kcLanguageTag) {
|
||||||
|
window.location.href = locale.supported.find(({ languageTag }) => languageTag === kcLanguageTag)!.url;
|
||||||
|
}
|
||||||
}, [kcLanguageTag]);
|
}, [kcLanguageTag]);
|
||||||
|
|
||||||
const [isExtraCssLoaded, setExtraCssLoaded] = useReducer(() => true, false);
|
const [isExtraCssLoaded, setExtraCssLoaded] = useReducer(() => true, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user