KEYCLOAK-7022 Fix l10n on Welcome page (#5143)
This commit is contained in:
parent
b78f0aa9db
commit
095fec95e5
2 changed files with 10 additions and 12 deletions
|
@ -38,6 +38,7 @@ import org.keycloak.services.managers.RealmManager;
|
|||
import org.keycloak.services.managers.AppAuthManager;
|
||||
import org.keycloak.services.managers.Auth;
|
||||
import org.keycloak.services.managers.AuthenticationManager;
|
||||
import org.keycloak.services.util.LocaleHelper;
|
||||
import org.keycloak.services.util.ResolveRelative;
|
||||
import org.keycloak.services.validation.Validation;
|
||||
import org.keycloak.theme.beans.MessageFormatterMethod;
|
||||
|
@ -100,16 +101,13 @@ public class AccountConsole {
|
|||
map.put("referrer_uri", referrer[1]);
|
||||
}
|
||||
|
||||
try {
|
||||
if (auth != null) {
|
||||
Locale locale = session.getContext().resolveLocale(auth.getUser());
|
||||
map.put("locale", locale.toLanguageTag());
|
||||
Properties messages = theme.getMessages(locale);
|
||||
map.put("msg", messagesToJsonString(messages));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to load messages", e);
|
||||
}
|
||||
UserModel user = null;
|
||||
if (auth != null) user = auth.getUser();
|
||||
Locale locale = LocaleHelper.getLocale(session, realm, user);
|
||||
map.put("locale", locale.toLanguageTag());
|
||||
Properties messages = theme.getMessages(locale);
|
||||
map.put("msg", new MessageFormatterMethod(locale, messages));
|
||||
map.put("msgJSON", messagesToJsonString(messages));
|
||||
|
||||
map.put("properties", theme.getProperties());
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="layout-pf-alt layout-pf-alt-fixed">
|
||||
<head>
|
||||
<title>Keycloak Account</title>
|
||||
<title>${msg("accountManagementTitle")}</title>
|
||||
|
||||
<script>
|
||||
var authUrl = '${authUrl}';
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
<#if msg??>
|
||||
var locale = '${locale}';
|
||||
var l18n_msg = JSON.parse('${msg?no_esc}');
|
||||
var l18n_msg = JSON.parse('${msgJSON?no_esc}');
|
||||
<#else>
|
||||
var locale = 'en';
|
||||
var l18n_msg = {};
|
||||
|
|
Loading…
Reference in a new issue