From ce770aed92c4279647d0bdd541a943ada9e6c743 Mon Sep 17 00:00:00 2001 From: Milton Ch <86965029+Milton-Ch@users.noreply.github.com> Date: Mon, 11 Apr 2022 10:28:39 -0400 Subject: [PATCH] fix(jans-auth-server): added faces context as source of locale (#1189) --- .../src/main/java/io/jans/as/server/i18n/LanguageBean.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jans-auth-server/server/src/main/java/io/jans/as/server/i18n/LanguageBean.java b/jans-auth-server/server/src/main/java/io/jans/as/server/i18n/LanguageBean.java index ffbf519fb9f..d772dfc1238 100644 --- a/jans-auth-server/server/src/main/java/io/jans/as/server/i18n/LanguageBean.java +++ b/jans-auth-server/server/src/main/java/io/jans/as/server/i18n/LanguageBean.java @@ -80,7 +80,7 @@ public void setLocaleCode(String requestedLocaleCode) { public Locale getLocale() { try { - Locale locale = getCookieLocale(); + Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale(); if (locale != null) { return locale; } @@ -152,6 +152,8 @@ private void setCookieValue(String value) { response.addCookie(cookie); } + @Deprecated + // Cookie is not storing value first time. This is causing default language setting private Locale getCookieLocale() { String cookieValue = getCookieValue(); if (StringHelper.isEmpty(cookieValue)) {