From 13b6c6f507bfc3519f4cd4e134723fe792488a96 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 3 Mar 2016 07:06:10 +0100 Subject: [PATCH] KEYCLOAK-2576 KEYCLOAK-2576 Changing locale on login screen doesn't affect current user --- .../keycloak/services/util/LocaleHelper.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/services/src/main/java/org/keycloak/services/util/LocaleHelper.java b/services/src/main/java/org/keycloak/services/util/LocaleHelper.java index 63f38d0514..18711931c6 100755 --- a/services/src/main/java/org/keycloak/services/util/LocaleHelper.java +++ b/services/src/main/java/org/keycloak/services/util/LocaleHelper.java @@ -61,16 +61,6 @@ public class LocaleHelper { } } - // User profile - if (user != null && user.getAttributes().containsKey(UserModel.LOCALE)) { - String localeString = user.getFirstAttribute(UserModel.LOCALE); - Locale locale = findLocale(realm.getSupportedLocales(), localeString); - if (locale != null) { - updateLocaleCookie(session, realm, localeString); - return locale; - } - } - // Locale cookie if (httpHeaders != null && httpHeaders.getCookies().containsKey(LOCALE_COOKIE)) { String localeString = httpHeaders.getCookies().get(LOCALE_COOKIE).getValue(); @@ -83,6 +73,16 @@ public class LocaleHelper { } } + // User profile + if (user != null && user.getAttributes().containsKey(UserModel.LOCALE)) { + String localeString = user.getFirstAttribute(UserModel.LOCALE); + Locale locale = findLocale(realm.getSupportedLocales(), localeString); + if (locale != null) { + updateLocaleCookie(session, realm, localeString); + return locale; + } + } + // ui_locales query parameter if (uriInfo != null && uriInfo.getQueryParameters().containsKey(UI_LOCALES_PARAM)) { String localeString = uriInfo.getQueryParameters().getFirst(UI_LOCALES_PARAM);