From 82b764d06c9333f41819cdec29720cd1c16ded70 Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Wed, 4 Sep 2013 15:13:55 -0400 Subject: [PATCH] Set up I18N on preferences page & fix button label id - fixes #804 --- .../webapp/modules/core/MOD-INF/controller.js | 2 +- .../modules/core/scripts/preferences.js | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/main/webapp/modules/core/MOD-INF/controller.js b/main/webapp/modules/core/MOD-INF/controller.js index eda9ef299..09ab801cc 100644 --- a/main/webapp/modules/core/MOD-INF/controller.js +++ b/main/webapp/modules/core/MOD-INF/controller.js @@ -494,8 +494,8 @@ function init() { "externals/jquery-ui/jquery-ui-1.8.20.custom.min.js", "externals/imgareaselect/jquery.imgareaselect.js", "externals/date.js", - "scripts/preferences.js", "externals/jquery.i18n.js", + "scripts/preferences.js", ] ); ClientSideResourceManager.addPaths( diff --git a/main/webapp/modules/core/scripts/preferences.js b/main/webapp/modules/core/scripts/preferences.js index b6045892b..014dc46dd 100644 --- a/main/webapp/modules/core/scripts/preferences.js +++ b/main/webapp/modules/core/scripts/preferences.js @@ -33,6 +33,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. var preferenceUIs = []; +var lang = navigator.language.split("-")[0] +|| navigator.userLanguage.split("-")[0]; +var dictionary = ""; +$.ajax({ +url : "/command/core/load-language?", +type : "POST", +async : false, +data : { +module : "core", +//lang : lang +}, +success : function(data) { +dictionary = data; +} +}); +$.i18n.setDictionary(dictionary); +//End internationalization + + function PreferenceUI(tr, key, value) { var self = this; @@ -112,7 +131,7 @@ function populatePreferences(prefs) { var tdLast0 = trLast.insertCell(0); trLast.insertCell(1); trLast.insertCell(2); - $('