PL-7113 Remember last used choosen language on web client

This commit is contained in:
Nikita Petunin 2016-06-20 19:22:25 +04:00
parent 163b4af1b4
commit 887dd9707a

View File

@ -199,6 +199,7 @@ public class LoginWindow extends UIView {
} }
protected Locale resolveLocale(App app) { protected Locale resolveLocale(App app) {
if (globalConfig.getLocaleSelectVisible()) {
String lastLocale = app.getCookieValue(COOKIE_LOCALE); String lastLocale = app.getCookieValue(COOKIE_LOCALE);
if (lastLocale != null) { if (lastLocale != null) {
for (Locale locale : locales.values()) { for (Locale locale : locales.values()) {
@ -207,6 +208,7 @@ public class LoginWindow extends UIView {
} }
} }
} }
}
for (Locale locale : locales.values()) { for (Locale locale : locales.values()) {
if (locale.equals(app.getLocale())) { if (locale.equals(app.getLocale())) {
@ -472,8 +474,10 @@ public class LoginWindow extends UIView {
// locale could be set on the server // locale could be set on the server
if (connection.getSession() != null) { if (connection.getSession() != null) {
app.setLocale(connection.getSession().getLocale()); app.setLocale(connection.getSession().getLocale());
if (globalConfig.getLocaleSelectVisible()) {
app.addCookie(COOKIE_LOCALE, locale.toLanguageTag()); app.addCookie(COOKIE_LOCALE, locale.toLanguageTag());
} }
}
} catch (LoginException e) { } catch (LoginException e) {
log.info("Login failed: " + e.toString()); log.info("Login failed: " + e.toString());
String message = StringUtils.abbreviate(e.getMessage(), 1000); String message = StringUtils.abbreviate(e.getMessage(), 1000);