added namespace migration documentation (#24497)
fixes: #23061 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
7d62f6308d
commit
44a95c72f1
1 changed files with 169 additions and 1 deletions
|
@ -160,4 +160,172 @@ The Map Store has been an experimental feature in previous releases.
|
|||
Starting with this release, it is removed and users should continue to use the current JPA store.
|
||||
|
||||
Since this release, it is no longer possible to use `--storage` related CLI options.
|
||||
The modules `keycloak-model-map*` have been removed.
|
||||
The modules `keycloak-model-map*` have been removed.
|
||||
|
||||
= Removed namespaces from our translations
|
||||
We moved all translations into one file for the admin-ui, if you have made your own translations or extended the admin ui you will need to migrate them to this new format.
|
||||
Also if you have "overrides" in your database you'll have to remove the namespace from the keys.
|
||||
Some keys are the same only in different namespaces, this is most obvious to help.
|
||||
In these cases we have postfix the key with `Help`.
|
||||
|
||||
If you want you can use this node script to help with the migration.
|
||||
It will take all the single files and put them into a new one and also take care of some of the mapping:
|
||||
|
||||
[source,js]
|
||||
----
|
||||
import { readFileSync, writeFileSync, appendFileSync } from "node:fs";
|
||||
|
||||
const ns = [
|
||||
"common",
|
||||
"common-help",
|
||||
"dashboard",
|
||||
"clients",
|
||||
"clients-help",
|
||||
"client-scopes",
|
||||
"client-scopes-help",
|
||||
"groups",
|
||||
"realm",
|
||||
"roles",
|
||||
"users",
|
||||
"users-help",
|
||||
"sessions",
|
||||
"events",
|
||||
"realm-settings",
|
||||
"realm-settings-help",
|
||||
"authentication",
|
||||
"authentication-help",
|
||||
"user-federation",
|
||||
"user-federation-help",
|
||||
"identity-providers",
|
||||
"identity-providers-help",
|
||||
"dynamic",
|
||||
];
|
||||
|
||||
const map = new Map();
|
||||
const dup = [];
|
||||
|
||||
ns.forEach((n) => {
|
||||
const rawData = readFileSync(n + ".json");
|
||||
const translation = JSON.parse(rawData);
|
||||
Object.entries(translation).map((e) => {
|
||||
const name = e[0];
|
||||
const value = e[1];
|
||||
if (map.has(name) && map.get(name) !== value) {
|
||||
if (n.includes("help")) {
|
||||
map.set(name + "Help", value);
|
||||
} else {
|
||||
map.set(name, value);
|
||||
dup.push({
|
||||
name: name,
|
||||
value: map.get(name),
|
||||
dup: { ns: n, value: value },
|
||||
});
|
||||
}
|
||||
} else {
|
||||
map.set(name, value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
writeFileSync(
|
||||
"translation.json",
|
||||
JSON.stringify(Object.fromEntries(map.entries()), undefined, 2),
|
||||
);
|
||||
|
||||
const mapping = [
|
||||
["common:clientScope", "clientScopeType"],
|
||||
["identity-providers:createSuccess", "createIdentityProviderSuccess"],
|
||||
["identity-providers:createError", "createIdentityProviderError"],
|
||||
["clients:createError", "createClientError"],
|
||||
["clients:createSuccess", "createClientSuccess"],
|
||||
["user-federation:createSuccess", "createUserProviderSuccess"],
|
||||
["user-federation:createError", "createUserProviderError"],
|
||||
["authentication-help:name", "flowNameHelp"],
|
||||
["authentication-help:description", "flowDescriptionHelp"],
|
||||
["clientScopes:noRoles", "noRoles-clientScope"],
|
||||
["clientScopes:noRolesInstructions", "noRolesInstructions-clientScope"],
|
||||
["users:noRoles", "noRoles-user"],
|
||||
["users:noRolesInstructions", "noRolesInstructions-user"],
|
||||
["clients:noRoles", "noRoles-client"],
|
||||
["clients:noRolesInstructions", "noRolesInstructions-client"],
|
||||
["groups:noRoles", "noRoles-group"],
|
||||
["groups:noRolesInstructions", "noRolesInstructions-group"],
|
||||
["roles:noRoles", "noRoles-roles"],
|
||||
["roles:noRolesInstructions", "noRolesInstructions-roles"],
|
||||
["realm:realmName:", "realmNameField"],
|
||||
["client-scopes:searchFor", "searchForClientScope"],
|
||||
["roles:searchFor", "searchForRoles"],
|
||||
["authentication:title", "titleAuthentication"],
|
||||
["events:title", "titleEvents"],
|
||||
["roles:title", "titleRoles"],
|
||||
["users:title", "titleUsers"],
|
||||
["sessions:title", "titleSessions"],
|
||||
["client-scopes:deleteConfirm", "deleteConfirmClientScopes"],
|
||||
["users:deleteConfirm", "deleteConfirmUsers"],
|
||||
["groups:deleteConfirm_one", "deleteConfirmGroup_one"],
|
||||
["groups:deleteConfirm_other", "deleteConfirmGroup_other"],
|
||||
["identity-providers:deleteConfirm", "deleteConfirmIdentityProvider"],
|
||||
["realm-settings:deleteConfirm", "deleteConfirmRealmSetting"],
|
||||
["roles:whoWillAppearLinkText", "whoWillAppearLinkTextRoles"],
|
||||
["users:whoWillAppearLinkText", "whoWillAppearLinkTextUsers"],
|
||||
["roles:whoWillAppearPopoverText", "whoWillAppearPopoverTextRoles"],
|
||||
["users:whoWillAppearPopoverText", "whoWillAppearPopoverTextUsers"],
|
||||
["client-scopes:deletedSuccess", "deletedSuccessClientScope"],
|
||||
["identity-providers:deletedSuccess", "deletedSuccessIdentityProvider"],
|
||||
["realm-settings:deleteSuccess", "deletedSuccessRealmSetting"],
|
||||
["client-scopes:deleteError", "deletedErrorClientScope"],
|
||||
["identity-providers:deleteError", "deletedErrorIdentityProvider"],
|
||||
["realm-settings:deleteError", "deletedErrorRealmSetting"],
|
||||
["realm-settings:saveSuccess", "realmSaveSuccess"],
|
||||
["user-federation:saveSuccess", "userProviderSaveSuccess"],
|
||||
["realm-settings:saveError", "realmSaveError"],
|
||||
["user-federation:saveError", "userProviderSaveError"],
|
||||
["realm-settings:validateName", "validateAttributeName"],
|
||||
["identity-providers:disableConfirm", "disableConfirmIdentityProvider"],
|
||||
["realm-settings:disableConfirm", "disableConfirmRealm"],
|
||||
["client-scopes:updateSuccess", "updateSuccessClientScope"],
|
||||
["client-scopes:updateError", "updateErrorClientScope"],
|
||||
["identity-providers:updateSuccess", "updateSuccessIdentityProvider"],
|
||||
["identity-providers:updateError", "updateErrorIdentityProvider"],
|
||||
["user-federation:orderChangeSuccess", "orderChangeSuccessUserFed"],
|
||||
["user-federation:orderChangeError", "orderChangeErrorUserFed"],
|
||||
["authentication-help:alias", "authenticationAliasHelp"],
|
||||
["authentication-help:flowType", "authenticationFlowTypeHelp"],
|
||||
["authentication:createFlow", "authenticationCreateFlowHelp"],
|
||||
["client-scopes-help:rolesScope", "clientScopesRolesScope"],
|
||||
["client-scopes-help:name", "scopeNameHelp"],
|
||||
["client-scopes-help:description", "scopeDescriptionHelp"],
|
||||
["client-scopes-help:type", "scopeTypeHelp"],
|
||||
["clients-help:description", "clientDescriptionHelp"],
|
||||
["clients-help:clientType", "clientsClientTypeHelp"],
|
||||
["clients-help:scopes", "clientsClientScopesHelp"],
|
||||
["common:clientScope", "clientScopeTypes"],
|
||||
["dashboard:realmName", "realmNameTitle"],
|
||||
["common:description", "description"],
|
||||
];
|
||||
|
||||
mapping.forEach((m) => {
|
||||
const key = m[0].split(":");
|
||||
try {
|
||||
const data = readFileSync(key[0] + ".json");
|
||||
const translation = JSON.parse(data);
|
||||
const value = translation[key[1]];
|
||||
if (value) {
|
||||
appendFileSync(
|
||||
"translation.json",
|
||||
'"' + m[1] + '": ' + JSON.stringify(value) + ',\n',
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("skipping namespace key: " + key);
|
||||
}
|
||||
});
|
||||
----
|
||||
|
||||
Save this into a file called `transform.mjs` in your `public/locale/<language>` folder and run it with:
|
||||
|
||||
[source]
|
||||
----
|
||||
node ./transform.mjs
|
||||
----
|
||||
NOTE: This might not do a complete transform, but very close to it.
|
Loading…
Reference in a new issue