From 333d279246fa0993dd33e5a0b168e5c8899cbda4 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 24 Nov 2015 14:57:40 -0500 Subject: [PATCH] (js) Ask to reload the page when changing language --- .../English.lproj/Localizable.strings | 38 ++++++++++--------- .../js/Preferences/PreferencesController.js | 16 +++++++- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index cb501daa0..12e4dc386 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -24,10 +24,10 @@ /* vacation (auto-reply) */ "Enable vacation auto reply" = "Enable vacation auto reply"; -"Auto reply message" ="Auto reply message"; -"Email addresses (separated by commas)" ="Email addresses (separated by commas)"; +"Auto reply message" = "Auto reply message"; +"Email addresses (separated by commas)" = "Email addresses (separated by commas)"; "Add default email addresses" = "Add default email addresses"; -"Days between responses" ="Days between responses"; +"Days between responses" = "Days between responses"; "Do not send responses to mailing lists" = "Do not send responses to mailing lists"; "Disable auto reply on" = "Disable auto reply on"; "Always send vacation message response" = "Always send vacation message response"; @@ -47,10 +47,10 @@ /* d & t */ -"Current Time Zone" ="Current Time Zone"; -"Short Date Format" ="Short Date Format"; -"Long Date Format" ="Long Date Format"; -"Time Format" ="Time Format"; +"Current Time Zone" = "Current Time Zone"; +"Short Date Format" = "Short Date Format"; +"Long Date Format" = "Long Date Format"; +"Time Format" = "Time Format"; "default" = "Default"; @@ -96,15 +96,15 @@ "timeFmt_4" = ""; /* calendar */ -"Week begins on" ="Week begins on"; -"Day start time" ="Day start time"; -"Day end time" ="Day end time"; +"Week begins on" = "Week begins on"; +"Day start time" = "Day start time"; +"Day end time" = "Day end time"; "Day start time must be prior to day end time." = "Day start time must be prior to day end time."; "Show time as busy outside working hours" = "Show time as busy outside working hours"; -"First week of year" ="First week of year"; +"First week of year" = "First week of year"; "Enable reminders for Calendar items" = "Enable reminders for Calendar items"; "Play a sound when a reminder comes due" = "Play a sound when a reminder comes due"; -"Default reminder" ="Default reminder"; +"Default reminder" = "Default reminder"; "firstWeekOfYear_January1" = "Starts on january 1"; "firstWeekOfYear_First4DayWeek" = "First 4-day week"; @@ -115,7 +115,7 @@ "Contacts Names" = "Contacts Names"; /* Default Calendar */ -"Default calendar" ="Default calendar"; +"Default calendar" = "Default calendar"; "selectedCalendar" = "Selected calendar"; "personalCalendar" = "Personal calendar"; "firstCalendar" = "First enabled calendar"; @@ -198,8 +198,8 @@ "Change" = "Change"; /* Event+task classifications */ -"Default events classification" ="Default events classification"; -"Default tasks classification" ="Default tasks classification"; +"Default events classification" = "Default events classification"; +"Default tasks classification" = "Default tasks classification"; "PUBLIC_item" = "Public"; "CONFIDENTIAL_item" = "Confidential"; "PRIVATE_item" = "Private"; @@ -220,9 +220,11 @@ "Mail" = "Mail"; "Last" = "Last used"; "Default Module " = "Default Module"; -"SOGo Version" ="SOGo Version"; +"SOGo Version" = "SOGo Version"; -"Language" ="Language"; +/* Confirmation asked when changing the language */ +"Save preferences and reload page now?" = "Save preferences and reload page now?"; +"Language" = "Language"; "choose" = "Choose ..."; "Arabic" = "العربية"; "Basque" = "Euskara"; @@ -251,7 +253,7 @@ "Ukrainian" = "Українська"; "Welsh" = "Cymraeg"; -"Refresh View" ="Refresh View"; +"Refresh View" = "Refresh View"; "refreshview_manually" = "Manually"; "refreshview_every_minute" = "Every minute"; "refreshview_every_2_minutes" = "Every 2 minutes"; diff --git a/UI/WebServerResources/js/Preferences/PreferencesController.js b/UI/WebServerResources/js/Preferences/PreferencesController.js index 7c83cda4a..039af37be 100644 --- a/UI/WebServerResources/js/Preferences/PreferencesController.js +++ b/UI/WebServerResources/js/Preferences/PreferencesController.js @@ -7,14 +7,15 @@ /** * @ngInject */ - PreferencesController.$inject = ['$state', '$mdDialog', '$mdToast', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication']; - function PreferencesController($state, $mdDialog, $mdToast, Dialog, User, Account, statePreferences, Authentication) { + PreferencesController.$inject = ['$q', '$window', '$state', '$mdDialog', '$mdToast', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication']; + function PreferencesController($q, $window, $state, $mdDialog, $mdToast, Dialog, User, Account, statePreferences, Authentication) { var vm = this, account, mailboxes = []; vm.preferences = statePreferences; vm.passwords = { newPassword: null, newPasswordConfirmation: null }; vm.go = go; + vm.onLanguageChange = onLanguageChange; vm.addCalendarCategory = addCalendarCategory; vm.removeCalendarCategory = removeCalendarCategory; vm.addContactCategory = addContactCategory; @@ -52,6 +53,17 @@ $state.go('preferences.' + module); } + function onLanguageChange() { + Dialog.confirm(l('Warning'), + l('Save preferences and reload page now?'), + {ok: l('Yes'), cancel: l('No')}) + .then(function() { + save().then(function() { + $window.location.reload(true); + }); + }); + } + function addCalendarCategory() { vm.preferences.defaults.SOGoCalendarCategoriesColors["New category"] = "#aaa"; vm.preferences.defaults.SOGoCalendarCategories.push("New category");