keycloak-ui
keycloak-ui copied to clipboard
Admin console "supported locales" dropdown doesn't show custom added language.
Describe the bug
By following Server Developer Guid, I added "zh-TW" (Traditional Chinese or 正體中文) to my custom theme.
The new language doesn't show up in dropdown menu.
I add "zh-TW" by directly access realm_supported_locales
table in database.
And it come up in language selector.
Version
19.0.1
Expected behavior
Supported locales should show up custom add language.
Actual behavior
No response
How to Reproduce?
I use docker to run keycloak.
keycloak
├─ themes
│ └─ mytheme
│ ├─ account
│ │ ├─ messages
│ │ │ ├─ messages_en.properties
│ │ │ └─ messages_zh_TW.properties
│ │ └─ theme.properties
│ ├─ email
│ │ ├─ messages
│ │ │ └─ messages_zh_TW.properties
│ │ └─ theme.properties
│ └─ login
│ ├─ messages
│ │ ├─ messages_en.properties
│ │ └─ messages_zh_TW.properties
│ └─ theme.properties
├─ docker-compose.yml
└─ dockerfile
- docker-compose.yml
binding
themes
to/opt/keycloak/themes
version: "3.2"
services:
keycloak:
container_name: keycloak
image: keycloak:my
build: .
restart: unless-stopped
volumes:
- type: bind
source: ./themes
target: /opt/keycloak/themes
entrypoint:
[
"/opt/keycloak/bin/kc.sh",
"start",
"--spi-theme-static-max-age=-1",
"--spi-theme-cache-themes=false",
"--spi-theme-cache-templates=false",
]
- themes/mytheme/account/messages/messages_en.properties
- themes/mytheme/login/messages/messages_en.properties
# encoding: utf-8
locale_zh-TW=正體中文
Anything else?
I also notice the "zh-CN" (Simplified Chinese or 简体中文) on "supported locales" dropdown shows "中文". Dose't match "中文简体" in origin resources properties.
https://github.com/keycloak/keycloak/blob/main/themes/src/main/resources/theme/base/account/messages/messages_en.properties
\u4e2d\u6587\u7b80\u4f53 is "中文简体"
locale_ca=Catal\u00e0
locale_cs=\u010Ce\u0161tina
locale_de=Deutsch
locale_en=English
locale_es=Espa\u00f1ol
locale_fr=Fran\u00e7ais
locale_hu=Magyar
locale_it=Italiano
locale_ja=\u65e5\u672c\u8a9e
locale_lt=Lietuvi\u0173
locale_nl=Nederlands
locale_no=Norsk
locale_pl=Polski
locale_pt-BR=Portugu\u00eas (Brasil)
locale_ru=\u0420\u0443\u0441\u0441\u043a\u0438\u0439
locale_sk=Sloven\u010dina
locale_sv=Svenska
locale_tr=T\u00FCrk\u00E7e
locale_zh-CN=\u4e2d\u6587\u7b80\u4f53
locale_fi=Suomi
Moving this issue to keycloak-ui repo.
@drsmile1001 Does the language show up if you switch to the old admin console?
To switch:
- Go to Realm Settings --> Themes
- Change Admin Console theme to
keycloak
Yes
I tried to reproduce this but for me it does show up when I add the locale to the theme.properties
locales:
You right we no longer uses the display names in the resource bundle, but instead use the names that the browser uses. So for
zh-TW
that is 中文(台灣)
and for zh-CH
it's 中文(中国)
Yeah, although the functionality does not match what was there before I'd argue this solution is actually better as it relies on standardized APIs. I vote to close this issue.
@ssilvert @edewit @agagancarczyk WDYT?
I tried to reproduce this but for me it does show up when I add the locale to the
theme.properties
locales:You right we no longer uses the display names in the resource bundle, but instead use the names that the browser uses. So for
zh-TW
that is中文(台灣)
and forzh-CH
it's中文(中国)
I try pull latest docker image. Admin UI versiondd67b3b3a4e80031d32fdf0ffd9e9d450a657d07
It show 中文(中国)
on Supported locales but zh-TW
not 中文(台灣)
But Default locale show 中文(台灣)
And zh-TW
option will disappear if unselect it.
Switch back to v1 theme. zh-TW
will appear.
PR #3487 fixes this