From 6222850453e14bdcbfa69b46f966cbaa0c2ca06b Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Wed, 3 Mar 2021 00:10:41 +0100 Subject: [PATCH] There is no reason not to let use translations outside of keycloak --- src/lib/i18n/useKcLanguageTag.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/i18n/useKcLanguageTag.ts b/src/lib/i18n/useKcLanguageTag.ts index b2775693..52ff25b9 100644 --- a/src/lib/i18n/useKcLanguageTag.ts +++ b/src/lib/i18n/useKcLanguageTag.ts @@ -2,14 +2,12 @@ import { createUseGlobalState } from "powerhooks"; import { kcContext } from "../kcContext"; import { getBestMatchAmongKcLanguageTag } from "./KcLanguageTag"; -import { assert } from "evt/tools/typeSafety/assert"; export const { useKcLanguageTag } = createUseGlobalState( "kcLanguageTag", - () => getBestMatchAmongKcLanguageTag(( - assert(kcContext !== undefined, "Page not served by KeyCloak"), - kcContext.locale?.["current" as never] ?? + () => getBestMatchAmongKcLanguageTag( + kcContext?.locale?.["current" as never] ?? navigator.language - )), + ), { "persistance": "cookies" } );