Compare commits

..

3 Commits

Author SHA1 Message Date
2707a6e69e Internatialization enabled not in english 2024-11-30 11:56:40 +01:00
fd3261cdf1 Bump version 2024-11-25 11:41:36 +01:00
b4b53d2552 Re export wide type def of the kcContext 2024-11-25 11:41:17 +01:00
3 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "keycloakify",
"version": "11.3.31",
"version": "11.3.32",
"description": "Framework to create custom Keycloak UIs",
"repository": {
"type": "git",

View File

@ -62,7 +62,12 @@ export async function command(params: { buildContext: BuildContext }) {
2
)};`,
``,
`type KcContext =`,
`/**`,
` * NOTE: Do not import this type except maybe in your entrypoint. `,
` * If you need to import the KcContext import it either from src/login/KcContext.ts or src/account/KcContext.ts.`,
` * Depending on the theme type you are working on.`,
` */`,
`export type KcContext =`,
hasLoginTheme && ` | import("./login/KcContext").KcContext`,
hasAccountTheme && ` | import("./account/KcContext").KcContext`,
hasAdminTheme && ` | import("./admin/KcContext").KcContext`,

View File

@ -94,7 +94,7 @@ export function createGetI18n<
return cachedResult;
}
const kcContextLocale = params.kcContext.realm.internationalizationEnabled ? params.kcContext.locale : undefined;
const kcContextLocale = kcContext.locale;
{
const currentLanguageTag = kcContextLocale?.currentLanguageTag ?? FALLBACK_LANGUAGE_TAG;
@ -214,6 +214,14 @@ export function createGetI18n<
});
}
if (!kcContext.realm.internationalizationEnabled) {
const enabledLanguage = enabledLanguages.find(({ languageTag }) => languageTag === currentLanguage.languageTag);
assert(enabledLanguage !== undefined);
return [enabledLanguage];
}
return enabledLanguages;
})();