There is no reason not to let use translations outside of keycloak

This commit is contained in:
Joseph Garrone 2021-03-03 00:10:41 +01:00
parent 305d5b7328
commit 6222850453

View File

@ -2,14 +2,12 @@
import { createUseGlobalState } from "powerhooks"; import { createUseGlobalState } from "powerhooks";
import { kcContext } from "../kcContext"; import { kcContext } from "../kcContext";
import { getBestMatchAmongKcLanguageTag } from "./KcLanguageTag"; import { getBestMatchAmongKcLanguageTag } from "./KcLanguageTag";
import { assert } from "evt/tools/typeSafety/assert";
export const { useKcLanguageTag } = createUseGlobalState( export const { useKcLanguageTag } = createUseGlobalState(
"kcLanguageTag", "kcLanguageTag",
() => getBestMatchAmongKcLanguageTag(( () => getBestMatchAmongKcLanguageTag(
assert(kcContext !== undefined, "Page not served by KeyCloak"), kcContext?.locale?.["current" as never] ??
kcContext.locale?.["current" as never] ??
navigator.language navigator.language
)), ),
{ "persistance": "cookies" } { "persistance": "cookies" }
); );