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);