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.AppAuthManager;
|
||||||
import org.keycloak.services.managers.Auth;
|
import org.keycloak.services.managers.Auth;
|
||||||
import org.keycloak.services.managers.AuthenticationManager;
|
import org.keycloak.services.managers.AuthenticationManager;
|
||||||
|
import org.keycloak.services.util.LocaleHelper;
|
||||||
import org.keycloak.services.util.ResolveRelative;
|
import org.keycloak.services.util.ResolveRelative;
|
||||||
import org.keycloak.services.validation.Validation;
|
import org.keycloak.services.validation.Validation;
|
||||||
import org.keycloak.theme.beans.MessageFormatterMethod;
|
import org.keycloak.theme.beans.MessageFormatterMethod;
|
||||||
|
@ -100,16 +101,13 @@ public class AccountConsole {
|
||||||
map.put("referrer_uri", referrer[1]);
|
map.put("referrer_uri", referrer[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
UserModel user = null;
|
||||||
if (auth != null) {
|
if (auth != null) user = auth.getUser();
|
||||||
Locale locale = session.getContext().resolveLocale(auth.getUser());
|
Locale locale = LocaleHelper.getLocale(session, realm, user);
|
||||||
map.put("locale", locale.toLanguageTag());
|
map.put("locale", locale.toLanguageTag());
|
||||||
Properties messages = theme.getMessages(locale);
|
Properties messages = theme.getMessages(locale);
|
||||||
map.put("msg", messagesToJsonString(messages));
|
map.put("msg", new MessageFormatterMethod(locale, messages));
|
||||||
}
|
map.put("msgJSON", messagesToJsonString(messages));
|
||||||
} catch (Exception e) {
|
|
||||||
logger.warn("Failed to load messages", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
map.put("properties", theme.getProperties());
|
map.put("properties", theme.getProperties());
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="layout-pf-alt layout-pf-alt-fixed">
|
<html class="layout-pf-alt layout-pf-alt-fixed">
|
||||||
<head>
|
<head>
|
||||||
<title>Keycloak Account</title>
|
<title>${msg("accountManagementTitle")}</title>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var authUrl = '${authUrl}';
|
var authUrl = '${authUrl}';
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<#if msg??>
|
<#if msg??>
|
||||||
var locale = '${locale}';
|
var locale = '${locale}';
|
||||||
var l18n_msg = JSON.parse('${msg?no_esc}');
|
var l18n_msg = JSON.parse('${msgJSON?no_esc}');
|
||||||
<#else>
|
<#else>
|
||||||
var locale = 'en';
|
var locale = 'en';
|
||||||
var l18n_msg = {};
|
var l18n_msg = {};
|
||||||
|
|
Loading…
Reference in a new issue