keycloak: Localization: Admin UI doesn't pick up message bundles from realms other than master
Before reporting an issue
- I have searched existing issues
- I have reproduced the issue with the latest nightly release
Area
admin/ui
Describe the bug
I use the User Profile functionality and inside Admin UI -> Users -> User detail I should be able to provide translated names, but this only works for non-english locales.
Version
22.0.1
Expected behavior
I add a custom property in the User profile section with a translated name ${customAttribute}, then I add a message bundle with the correct translations users:customAttribute. Then I should see my users:customAttribute value in the User details page.
Actual behavior
I see customAttribute written there, but if I do the same procedure for eg. german, than it works!
How to Reproduce?
- Add a new custom attribute with name
customAttributein the user profile. - Add a displayname of
${customAttribute} - Add a message bundle
users:customAttribute - Look at a user profile
Anything else?
As far as I can tell, there is a difference between how the english translation is handled and any other.
After my procedure I see that the Admin UI is loading the translations from: http://localhost:8080/admin/realms/master/localization/en
But if I switch the language to german the translations are loaded from: http://localhost:8080/admin/realms/my-realm/localization/de
Or if I don’t login through the master realm the english translations also work and are loaded from: http://localhost:8080/admin/realms/my-realm/localization/en
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 19 (19 by maintainers)
Commits related to this issue
- use login realm fixes: #22431, fixes: #25152 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> — committed to edewit/keycloak by edewit 7 months ago
- use login realm (#25466) fixes: #22431, fixes: #25152 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> — committed to keycloak/keycloak by edewit 7 months ago
- use login realm (#25466) fixes: #22431, fixes: #25152 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> Signed-off-by: Danusorn Taboonyong <osacn_danusorn.taboonyong@krungthai.com> — committed to parnus01/keycloak by edewit 7 months ago
- use login realm (#25466) fixes: #22431, fixes: #25152 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com> — committed to srose/keycloak by edewit 7 months ago
In my opinion it would make sense to respect the
Realm Settings -> Localizationof the non-master realm. At the moment this is where to set localizations which are then applied at:/admin/${realm_name}/console/- this one picks up the realm specific localizations instead of the once from the master)Where these localizations are currently not applied at:
/admin/master/console/- when managing user details of a non master realm.Imho having it in the theme comes with some big disadvantage:
We should probably put a warning message on the internationalization tab to let users know what they are doing is probably wrong and then point them to the documentation.
@jonkoops Thanks. Filed https://github.com/keycloak/keycloak/issues/22791
The “right” way is to first decide if your localized message should apply at the theme level or at the realm level. Usually, the answer is that you want the message to be localized for any realm that uses the theme. So, “theme level” is usually the right answer.
If the message is at the realm level then use the admin console UI.
If the message is at the theme level, override the message bundle in your theme according to https://www.keycloak.org/docs/latest/server_development/#messages. Note that for admin console V2, you will override
jsonfiles instead ofpropertiesfiles.