diff --git a/package.json b/package.json
index e16f9f1c..e05a8f29 100755
--- a/package.json
+++ b/package.json
@@ -56,7 +56,7 @@
"cheerio": "^1.0.0-rc.5",
"evt": "2.0.0-beta.15",
"minimal-polyfills": "^2.1.6",
- "powerhooks": "^0.0.14",
+ "powerhooks": "^0.0.17",
"tss-react": "^0.0.9"
}
}
diff --git a/src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts b/src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts
index e1f0a615..da1907e2 100644
--- a/src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts
+++ b/src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts
@@ -90,11 +90,6 @@ export function generateKeycloakThemeResources(
"destDirPath": tmpDirPath
});
- transformCodebase({
- "srcDirPath": pathJoin(tmpDirPath, "keycloak", "common"),
- "destDirPath": pathJoin(tmpDirPath, "..", "common")
- });
-
transformCodebase({
"srcDirPath": pathJoin(tmpDirPath, "keycloak", "login", "resources"),
"destDirPath": pathJoin(themeDirPath, "resources")
@@ -106,10 +101,7 @@ export function generateKeycloakThemeResources(
fs.writeFileSync(
pathJoin(themeDirPath, "theme.properties"),
- Buffer.from([
- `import=common/${themeName}`,
- "locales=ca,cs,de,en,es,fr,it,ja,lt,nl,no,pl,pt-BR,ru,sk,sv,tr,zh-CN"
- ].join("\n"), "utf8")
+ Buffer.from("parent=keycloak", "utf8")
);
}
diff --git a/src/lib/components/Template.tsx b/src/lib/components/Template.tsx
index 3048e054..b199e997 100644
--- a/src/lib/components/Template.tsx
+++ b/src/lib/components/Template.tsx
@@ -44,7 +44,7 @@ export const Template = memo((props: TemplateProps) => {
displayInfoNode = null
} = props;
- console.log("Rendering this page with react using keycloak-react-theming");
+ useEffect(()=> { console.log("Rendering this page with react using keycloak-react-theming") },[]);
const { t } = useKcTranslation();
@@ -53,7 +53,7 @@ export const Template = memo((props: TemplateProps) => {
const { kcLanguageTag, setKcLanguageTag } = useKcLanguageTag();
const onChangeLanguageClickFactory = useCallbackFactory(
- ([languageTag]: [KcLanguageTag]) =>
+ ([languageTag]: [KcLanguageTag]) =>
setKcLanguageTag(languageTag)
);
@@ -138,9 +138,9 @@ export const Template = memo((props: TemplateProps) => {
{
locale.supported.map(
- ({ languageTag }) =>
+ ({ languageTag, url }) =>
-
-
+
{getKcLanguageTagLabel(languageTag)}
diff --git a/src/lib/i18n/KcLanguageTag.ts b/src/lib/i18n/KcLanguageTag.ts
index 491a19a0..e256e635 100644
--- a/src/lib/i18n/KcLanguageTag.ts
+++ b/src/lib/i18n/KcLanguageTag.ts
@@ -55,12 +55,16 @@ export function getBestMatchAmongKcLanguageTag(
const iso2LanguageLike = languageLike.split("-")[0].toLowerCase();
- const language = availableLanguages.find(language =>
+ const kcLanguageTag = availableLanguages.find(language =>
language.toLowerCase().includes(iso2LanguageLike) ||
getKcLanguageTagLabel(language).toLocaleLowerCase() === languageLike.toLocaleLowerCase()
);
- if (language === undefined && languageLike !== navigator.language) {
+ if (kcLanguageTag !== undefined) {
+ return kcLanguageTag;
+ }
+
+ if (languageLike !== navigator.language) {
return getBestMatchAmongKcLanguageTag(navigator.language);
}
diff --git a/src/lib/i18n/useKcLanguageTag.ts b/src/lib/i18n/useKcLanguageTag.ts
index 52ff25b9..86d4a5c1 100644
--- a/src/lib/i18n/useKcLanguageTag.ts
+++ b/src/lib/i18n/useKcLanguageTag.ts
@@ -9,5 +9,5 @@ export const { useKcLanguageTag } = createUseGlobalState(
kcContext?.locale?.["current" as never] ??
navigator.language
),
- { "persistance": "cookies" }
+ { "persistance": "cookie" }
);
diff --git a/src/lib/kcContext.ts b/src/lib/kcContext.ts
index b8ff8a6e..97ed1c25 100644
--- a/src/lib/kcContext.ts
+++ b/src/lib/kcContext.ts
@@ -27,7 +27,7 @@ export declare namespace KcContext {
/** Undefined if !realm.internationalizationEnabled */
locale?: {
supported: {
- //url: string;
+ url: string;
languageTag: KcLanguageTag;
/** Is determined by languageTag. Ex: languageTag === "en" => label === "English"
* or getLanguageLabel(languageTag) === label
diff --git a/yarn.lock b/yarn.lock
index c940a214..cfa3083d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -43,9 +43,9 @@
"@babel/helper-plugin-utils" "^7.12.13"
"@babel/runtime@^7.7.2":
- version "7.13.8"
- resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.8.tgz#cc886a85c072df1de23670dc1aa59fc116c4017c"
- integrity sha512-CwQljpw6qSayc0fRG1soxHAKs1CnQMOChm4mlQP6My0kf9upVGizj/KhlTTgyUnETmHpcUXjaluNAkteRFuafg==
+ version "7.13.9"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.9.tgz#97dbe2116e2630c489f22e0656decd60aaa1fcee"
+ integrity sha512-aY2kU+xgJ3dJ1eU6FMB9EH8dIe8dmusF1xEku52joLvw6eAFN0AI+WxCLDnpev2LEejWBAy2sBvBOBAjI3zmvA==
dependencies:
regenerator-runtime "^0.13.4"
@@ -176,10 +176,10 @@
"@octokit/types" "^6.0.3"
universal-user-agent "^6.0.0"
-"@octokit/openapi-types@^5.2.0":
- version "5.2.0"
- resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-5.2.0.tgz#54e6ca0bc2cd54cd93f0a64658e893c32a5e69ec"
- integrity sha512-MInMij2VK5o96Ei6qaHjxBglSZWOXQs9dTZfnGX2Xnr2mhA+yk9L/QCH4RcJGISJJCBclLHuY3ytq+iRgDfX7w==
+"@octokit/openapi-types@^5.3.0":
+ version "5.3.0"
+ resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-5.3.0.tgz#29e3faa119da90082dc653ea74c8bb345d197bf7"
+ integrity sha512-5q2qBz4iZ0xS/DEJ0ROusFbN4cVlbJE9GvOByen+mv7artuGXfVhONqcuRd7jYN2glTmCnzcZw+X6LrjRVqs0A==
"@octokit/plugin-paginate-rest@^2.6.2":
version "2.11.0"
@@ -193,12 +193,12 @@
resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz#70a62be213e1edc04bb8897ee48c311482f9700d"
integrity sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ==
-"@octokit/plugin-rest-endpoint-methods@4.13.0":
- version "4.13.0"
- resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.13.0.tgz#59a90f59a564d416214ab191c3ffcd641f175e6a"
- integrity sha512-Ofusy7BwHkU7z4TNsVdf7wm5W3KR625KqlQj4AiWPnBvclmZU0Y2bVK8b8Mz8nW7sEX9TJcCdX6KeaincE/cLw==
+"@octokit/plugin-rest-endpoint-methods@4.13.3":
+ version "4.13.3"
+ resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.13.3.tgz#17ba3a24adce0933129cfefa6d44e7da2eeac04b"
+ integrity sha512-nMGS2osFcWXRfHkDR0d+lB1zpMPTZJ0NjysPUfs7BT5/juNG/Q0+5UB6nC1f62jPzun154qekzwOb7Q5oahCXQ==
dependencies:
- "@octokit/types" "^6.11.0"
+ "@octokit/types" "^6.12.0"
deprecation "^2.3.1"
"@octokit/request-error@^2.0.0":
@@ -225,21 +225,21 @@
universal-user-agent "^6.0.0"
"@octokit/rest@^18.0.0":
- version "18.3.0"
- resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.3.0.tgz#c326475a2039ffeaec9a1498ebee14a561aae4e5"
- integrity sha512-R45oBVhnq3HAOGVtC6lHY7LX7TGWqbbcD4KvBHoT4QIjgJzfqKag3m/DUJwLnp8xrokz1spZmspTIXiDeQqJSA==
+ version "18.3.3"
+ resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.3.3.tgz#a3b0f24bf5c42cacd93dbc48576b5d4d4e032a38"
+ integrity sha512-OxElwBanZn1AShCaIrRTLM9PwhGE5/busMke/go30OWAQ+eJMD7Us/67mtapE77EYY4FM2tvb4Eg25rZaA/NPA==
dependencies:
"@octokit/core" "^3.2.3"
"@octokit/plugin-paginate-rest" "^2.6.2"
"@octokit/plugin-request-log" "^1.0.2"
- "@octokit/plugin-rest-endpoint-methods" "4.13.0"
+ "@octokit/plugin-rest-endpoint-methods" "4.13.3"
-"@octokit/types@^6.0.3", "@octokit/types@^6.11.0", "@octokit/types@^6.7.1":
- version "6.11.0"
- resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.11.0.tgz#830a608882cde659be19a6e86568abaa619e2ee7"
- integrity sha512-RMLAmpPZf/a33EsclBazKg02NCCj4rC69V9sUgf0SuWTjmnBD2QC1nIVtJo7RJrGnwG1+aoFBb2yTrWm/8AS7w==
+"@octokit/types@^6.0.3", "@octokit/types@^6.11.0", "@octokit/types@^6.12.0", "@octokit/types@^6.7.1":
+ version "6.12.0"
+ resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.12.0.tgz#8376fd60edfd5d1eebfeedb994c6bcb5b862c7a1"
+ integrity sha512-KwOf16soD7aDEEi/PgNeJlHzjZPfrmmNy+7WezSdrpnqZ7YImBJcNnX9+5RUHt1MnA4h8oISRHTqaZDGsX9DRQ==
dependencies:
- "@octokit/openapi-types" "^5.2.0"
+ "@octokit/openapi-types" "^5.3.0"
"@types/comment-json@^1.1.1":
version "1.1.1"
@@ -615,10 +615,10 @@ event-emitter@^0.3.5:
d "1"
es5-ext "~0.10.14"
-evt@2.0.0-beta.12:
- version "2.0.0-beta.12"
- resolved "https://registry.yarnpkg.com/evt/-/evt-2.0.0-beta.12.tgz#d24724ea4c70e78af3eb73dbbf3ece81d295a1e7"
- integrity sha512-KoDNXD73aKIGhylvFVYyEjoTTHKWofi0ozaRrvW4rjXZ1XbSUEat+iGSsy/S387v3ZkKB9UI499hT7WtNGzSrw==
+evt@2.0.0-beta.13:
+ version "2.0.0-beta.13"
+ resolved "https://registry.yarnpkg.com/evt/-/evt-2.0.0-beta.13.tgz#a84828cc15b535fabdeaf551982d0705ed428a6f"
+ integrity sha512-Y71l8BU1r/hs7MOyaNb5PTf8Jp+5h8Vt6T8ixvJSqDmKhwCjjCVKP2b1E3UE+Qlr1bZnCOWnVTucTeTeJghWEQ==
dependencies:
minimal-polyfills "^2.1.5"
run-exclusive "^2.2.14"
@@ -932,12 +932,12 @@ path-type@^4.0.0:
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
-powerhooks@^0.0.14:
- version "0.0.14"
- resolved "https://registry.yarnpkg.com/powerhooks/-/powerhooks-0.0.14.tgz#1456620de2d2b899f54509a8ef909c4c15694c81"
- integrity sha512-fse74qwumuETne++wc3asYlhuaQYvKHUUzsAbNQfBb5OK3J12KbBYM3kh+ZPOf5C9/OAJg/qAAXsz2G/5ROS4w==
+powerhooks@^0.0.17:
+ version "0.0.17"
+ resolved "https://registry.yarnpkg.com/powerhooks/-/powerhooks-0.0.17.tgz#840295271d989c27b83047fad44973434c509ba7"
+ integrity sha512-9z0C5pnVJI3SRKgcoAjbOxVa1lf/e58N+YdByThue1C4DUqfp8umx9XvrRJJ3dGwl6A0RRrJlyPM1KXjVChQMQ==
dependencies:
- evt "2.0.0-beta.12"
+ evt "2.0.0-beta.13"
memoizee "^0.4.15"
resize-observer-polyfill "^1.5.1"
@@ -1130,9 +1130,9 @@ type@^2.0.0:
integrity sha512-rgPIqOdfK/4J9FhiVrZ3cveAjRRo5rsQBAIhnylX874y1DX/kEKSVdLsnuHB6l1KTjHyU01VjiMBHgU2adejyg==
typescript@^4.1.5:
- version "4.2.2"
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz#1450f020618f872db0ea17317d16d8da8ddb8c4c"
- integrity sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==
+ version "4.2.3"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
+ integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
universal-user-agent@^6.0.0:
version "6.0.0"