简体   繁体   English

如何在keycloak登录页面中选择语言环境,而不是用户默认语言环境?

[英]How to get locale selected in keycloak login page, not user default locale?

I am working on a springboot application with the keycloak springboot adaptor.我正在使用 keycloak springboot 适配器开发一个 springboot 应用程序。 In the AccessToken, I can find the locale defined in the user keycloak.在 AccessToken 中,我可以找到用户 keycloak 中定义的语言环境。 But i want to get the locale selected on the login page.但我想在登录页面上选择语言环境。

How can get this info?怎样才能得到这些信息?

thanks in advance提前致谢

In my application (@ Server A ) the /backoffice urls secured by Keycloak.在我的应用程序(@Server A )中,由 Keycloak 保护的/backoffice url。 If a user will open the backoffice he is redirected to Keycloak login (@ Server B ).如果用户打开后台,他会被重定向到 Keycloak 登录(@Server B )。

If I pass ui_locales=de or ui_locales=en in my application on Server A then it's respected during the redirect and Keycloak will display the login page in the proper language on Server B .如果我在服务器 A上的应用程序中传递ui_locales=deui_locales=en ,则在重定向期间会尊重它,并且 Keycloak 将在服务器 B上以正确的语言显示登录页面。

Beforehand, de and en message properties files a present in your Keycloak themes and internationalization must enabled in your Keycloak realm configuration.事先,必须在 Keycloak realm 配置中启用 Keycloak 主题中的 de 和 en 消息属性文件和国际化

localhost:5050/backoffice?ui_locales=de result in german Keycloak login page and localhost:5050/backoffice?ui_locales=en results in english Keycloak login page. localhost:5050/backoffice?ui_locales=de德语 Keycloak 登录页面, localhost:5050/backoffice?ui_locales=en生成英文 Keycloak 登录页面。

greetz问候

My sources and thanks to:我的消息来源并感谢:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取选定区域设置的所有国家字符? - How to get all national characters for selected Locale? 当他访问网站并以用户语言显示页面时,如何在jsp页面中获得用户区域设置 - how get user locale in jsp page when he visit website and display page in user language GWT-在默认语言环境中格式化数字,而不管选择的语言环境如何 - GWT - formatting numbers in default locale regardless of selected locale 使用 keycloak java 库设置 keycloak 用户语言环境 - Setting keycloak user locale using keycloak java library 如何获取systeminfo语言环境 - Locale.getDefault() - How to get systeminfo locale - Locale.getDefault() 无论当前的默认语言环境如何,如何获取默认的 ResourceBundle - How to get the default ResourceBundle regardless of current default Locale Tapestry:起始页面使用英语语言环境而不是默认语言环境 - Tapestry : Start page use english locale instead of default locale 如何在ResourceBundleMessageSource中设置默认语言环境? - How to set default locale in ResourceBundleMessageSource? 如果locale无效,则Spring mvc从请求中获取默认语言环境 - Spring mvc get default locale from request if locale is invalid 如何根据时区或地区或用户偏好获取当前日期? - How to get current date based on time zone or locale, or user preference?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM