keycloak-ui
keycloak-ui copied to clipboard
Realm configuration page does not show new added language in the supported language list
Describe the bug
Hello, I want to support 'az' language on my custom login view. I followed these https://www.keycloak.org/docs/latest/server_development/#adding-a-language-to-a-realm guide and did all. But I could not see my new added language on admin page.
Version
19.0.3
Expected behavior
I should see the language in the supported language list on admin page
Actual behavior
Combo shows only default supported language list
How to Reproduce?
Follow the instructions and add locale 'az'
Anything else?
No response
Hi, could you please check the latest docs? https://www.keycloak.org/docs/latest/server_development/#adding-a-language-to-a-realm
@lexcao sorry I put wrong document url. I followed the latest doc guide.
Could you provide a reproduce? It's most likely caused by some trivial mistake on how you created it
@stianst I don't think I did some mistake. Because on the debug session I saw that my language added. But on the UI side I did not see the my language. To reproducing just follow the documentation and add az
locale. I tried both way. Putting my custom theme under theme folder, or creating jar file and put the provider build and start server. I saw my them on the admin page and assign to my realm, but could not choose the language
I've just tried this out here and the issue is in the new admin console.
The old admin console shows the list of locales based on the current selected login, email, and account, and will only show the options that are supported by all.
However, the new admin console seems to only show the built-in locales regardless of what theme is selected, and what they support.
Added a basic example here https://github.com/stianst/playground/tree/main/sunrise that can be used to test the new admin console.
From the old admin console when sunrise example from above is applied it will only show az
as the option:
However, the new admin console shows all built-in locales that aren't supported by the selected themes, and doesn't include the custom locale:
I believe this might be fixed already. Could you try running this in a nightly version and see if the problem still persists?
Just tried the latest nightly and can't see any changes in behaviour there, so believe the issue still exists.
@stianst I'm wondering how this should work so there are multiple themes:
"admin":[
{
"name":"base",
"locales":[
"ca",
"de",
"en",
"es",
"fr",
"it",
"ja",
"lt",
"nl",
"no",
"pl",
"pt-BR",
"ru",
"sv",
"zh-CN"
]
},
{
"name":"keycloak",
"locales":[
"ca",
"de",
"en",
"es",
"fr",
"it",
"ja",
"lt",
"nl",
"no",
"pl",
"pt-BR",
"ru",
"sv",
"zh-CN"
]
}
],
That all support their own set of locales and there is only one supported locale setting. The new UI merges all the theme locales and shows them into the dropdown, but that is incorrect? You say it should be based on what theme is selected, but that begs the question: for which category account, login or email?
The way the old admin console does it is by only showing locales that are supported by all end-user facing themes (account, login, and email).
So that means you can't set az
when you only have it for login?
Yeah, so to add a custom locale you need to have a custom theme for account, login, and email. That's exactly what https://github.com/stianst/playground/tree/main/sunrise is doing.
The "custom theme" doesn't strictly have to provide any translations, it just needs to say it supports the locale. Nor does the theme have to do anything other than simply add the locale.
Not the most elegant, but this is what the old admin console does:
https://github.com/keycloak/keycloak/blob/43a3677cc727469a7c0d46c95436420e0ff3feb5/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js#L543-L579
Yeah I saw that and figured that was wrong, I still do. So you are saying, that if I want to add a locale for the login theme I have to create 3 themes and select all of those and only then can I set the supported locale to the locale I want to add for login?
So are we supposed to support the typing the local by hand like the old console also did? Or do we improve it by adding the local if one of the themes support it? I'm fine with all these options just want somebody to make a decision on this.