From cb2ab9152f993a93e3acc11254fe858e8c217d58 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 30 Aug 2017 14:18:23 -0400 Subject: [PATCH] (js) Don't change user language when not changed Fixes #4244 --- UI/MainUI/SOGoRootPage.m | 5 +++++ UI/Templates/MainUI/SOGoRootPage.wox | 4 +++- UI/WebServerResources/js/Main/Main.app.js | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/UI/MainUI/SOGoRootPage.m b/UI/MainUI/SOGoRootPage.m index 80952dc63..a31839864 100644 --- a/UI/MainUI/SOGoRootPage.m +++ b/UI/MainUI/SOGoRootPage.m @@ -535,6 +535,11 @@ return [[context resourceLookupLanguages] objectAtIndex: 0]; } +- (NSString *) localizedLanguage +{ + return [self labelForKey: [self language]]; +} + - (NSArray *) languages { return [[SOGoSystemDefaults sharedSystemDefaults] supportedLanguages]; diff --git a/UI/Templates/MainUI/SOGoRootPage.wox b/UI/Templates/MainUI/SOGoRootPage.wox index fbc2123e7..be037ced3 100644 --- a/UI/Templates/MainUI/SOGoRootPage.wox +++ b/UI/Templates/MainUI/SOGoRootPage.wox @@ -57,7 +57,9 @@ language - + diff --git a/UI/WebServerResources/js/Main/Main.app.js b/UI/WebServerResources/js/Main/Main.app.js index 114406fed..2bf9f9970 100644 --- a/UI/WebServerResources/js/Main/Main.app.js +++ b/UI/WebServerResources/js/Main/Main.app.js @@ -17,9 +17,11 @@ this.creds = { username: $window.cookieUsername, password: null, - language: $window.language, rememberLogin: angular.isDefined($window.cookieUsername) && $window.cookieUsername.length > 0 }; + // Send selected language only if user has changed it + if (/\blanguage=/.test($window.location.search)) + this.creds.language = $window.language; this.loginState = false; // Show login once everything is initialized