From b7675946f8a983edd1c08ba5b32d756c75ae3c6e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Jan 2018 14:40:59 +0300 Subject: [PATCH] Support for languages with "_" separator (en_US). --- apps/common/locale.js | 2 +- apps/documenteditor/embed/index.html | 2 +- apps/documenteditor/embed/index.html.deploy | 2 +- apps/documenteditor/main/app/view/FileMenuPanels.js | 2 +- apps/documenteditor/main/index.html | 2 +- apps/documenteditor/main/index.html.deploy | 2 +- apps/documenteditor/mobile/index.html | 2 +- apps/documenteditor/mobile/index.html.deploy | 2 +- apps/presentationeditor/embed/index.html | 2 +- apps/presentationeditor/embed/index.html.deploy | 2 +- apps/presentationeditor/main/app/view/FileMenuPanels.js | 2 +- apps/presentationeditor/main/index.html | 2 +- apps/presentationeditor/main/index.html.deploy | 2 +- apps/presentationeditor/main/index.reporter.html | 2 +- apps/presentationeditor/main/index.reporter.html.deploy | 2 +- apps/presentationeditor/mobile/index.html | 2 +- apps/presentationeditor/mobile/index.html.deploy | 2 +- apps/spreadsheeteditor/embed/index.html | 2 +- apps/spreadsheeteditor/embed/index.html.deploy | 2 +- apps/spreadsheeteditor/main/app/controller/Main.js | 2 +- apps/spreadsheeteditor/main/app/view/FileMenuPanels.js | 4 ++-- apps/spreadsheeteditor/main/index.html | 2 +- apps/spreadsheeteditor/main/index.html.deploy | 2 +- .../mobile/app/controller/add/AddFunction.js | 4 ++-- apps/spreadsheeteditor/mobile/index.html | 2 +- apps/spreadsheeteditor/mobile/index.html.deploy | 2 +- 26 files changed, 28 insertions(+), 28 deletions(-) diff --git a/apps/common/locale.js b/apps/common/locale.js index 4112b39c1..9d401fffc 100644 --- a/apps/common/locale.js +++ b/apps/common/locale.js @@ -100,7 +100,7 @@ Common.Locale = new(function() { var langParam = _getUrlParameterByName('lang'); var xhrObj = _createXMLHTTPObject(); if (xhrObj && langParam) { - var lang = langParam.split("-")[0]; + var lang = langParam.split(/[\-\_]/)[0]; xhrObj.open('GET', 'locale/' + lang + '.json', false); xhrObj.send(''); l10n = eval("(" + xhrObj.responseText + ")"); diff --git a/apps/documenteditor/embed/index.html b/apps/documenteditor/embed/index.html index e38b8579b..ec5a7131a 100644 --- a/apps/documenteditor/embed/index.html +++ b/apps/documenteditor/embed/index.html @@ -233,7 +233,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/documenteditor/embed/index.html.deploy b/apps/documenteditor/embed/index.html.deploy index f7f7eff2a..d447be7e1 100644 --- a/apps/documenteditor/embed/index.html.deploy +++ b/apps/documenteditor/embed/index.html.deploy @@ -225,7 +225,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 8aa55f3d0..9630674d3 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -1075,7 +1075,7 @@ define([ var me = this; var store = this.viewHelpPicker.store; if (lang) { - lang = lang.split("-")[0]; + lang = lang.split(/[\-\_]/)[0]; var config = { dataType: 'json', error: function () { diff --git a/apps/documenteditor/main/index.html b/apps/documenteditor/main/index.html index 1061a2bdc..bd847a88c 100644 --- a/apps/documenteditor/main/index.html +++ b/apps/documenteditor/main/index.html @@ -219,7 +219,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/documenteditor/main/index.html.deploy b/apps/documenteditor/main/index.html.deploy index 4e8d56999..bff778250 100644 --- a/apps/documenteditor/main/index.html.deploy +++ b/apps/documenteditor/main/index.html.deploy @@ -218,7 +218,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/documenteditor/mobile/index.html b/apps/documenteditor/mobile/index.html index 38c2e488f..adca9ea79 100644 --- a/apps/documenteditor/mobile/index.html +++ b/apps/documenteditor/mobile/index.html @@ -206,7 +206,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/documenteditor/mobile/index.html.deploy b/apps/documenteditor/mobile/index.html.deploy index dd7879ed1..7a3e17069 100644 --- a/apps/documenteditor/mobile/index.html.deploy +++ b/apps/documenteditor/mobile/index.html.deploy @@ -205,7 +205,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/presentationeditor/embed/index.html b/apps/presentationeditor/embed/index.html index b093b6577..e1b9d888f 100644 --- a/apps/presentationeditor/embed/index.html +++ b/apps/presentationeditor/embed/index.html @@ -232,7 +232,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/presentationeditor/embed/index.html.deploy b/apps/presentationeditor/embed/index.html.deploy index e516bfe24..e28800664 100644 --- a/apps/presentationeditor/embed/index.html.deploy +++ b/apps/presentationeditor/embed/index.html.deploy @@ -225,7 +225,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 4ecdd3f82..4e3ec2859 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -849,7 +849,7 @@ define([ var me = this; var store = this.viewHelpPicker.store; if (lang) { - lang = lang.split("-")[0]; + lang = lang.split(/[\-\_]/)[0]; var config = { dataType: 'json', error: function () { diff --git a/apps/presentationeditor/main/index.html b/apps/presentationeditor/main/index.html index dceb753f4..463145162 100644 --- a/apps/presentationeditor/main/index.html +++ b/apps/presentationeditor/main/index.html @@ -218,7 +218,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/presentationeditor/main/index.html.deploy b/apps/presentationeditor/main/index.html.deploy index 8ddfe9f80..4425f7eb2 100644 --- a/apps/presentationeditor/main/index.html.deploy +++ b/apps/presentationeditor/main/index.html.deploy @@ -218,7 +218,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/presentationeditor/main/index.reporter.html b/apps/presentationeditor/main/index.reporter.html index 726977040..d2b04c92f 100644 --- a/apps/presentationeditor/main/index.reporter.html +++ b/apps/presentationeditor/main/index.reporter.html @@ -222,7 +222,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/presentationeditor/main/index.reporter.html.deploy b/apps/presentationeditor/main/index.reporter.html.deploy index f0e992331..9d3929bb7 100644 --- a/apps/presentationeditor/main/index.reporter.html.deploy +++ b/apps/presentationeditor/main/index.reporter.html.deploy @@ -218,7 +218,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/presentationeditor/mobile/index.html b/apps/presentationeditor/mobile/index.html index a9ea1b6e2..94bfdf23a 100644 --- a/apps/presentationeditor/mobile/index.html +++ b/apps/presentationeditor/mobile/index.html @@ -206,7 +206,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/presentationeditor/mobile/index.html.deploy b/apps/presentationeditor/mobile/index.html.deploy index dd7879ed1..7a3e17069 100644 --- a/apps/presentationeditor/mobile/index.html.deploy +++ b/apps/presentationeditor/mobile/index.html.deploy @@ -205,7 +205,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/spreadsheeteditor/embed/index.html b/apps/spreadsheeteditor/embed/index.html index 99a46ebed..2e9294c74 100644 --- a/apps/spreadsheeteditor/embed/index.html +++ b/apps/spreadsheeteditor/embed/index.html @@ -233,7 +233,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/spreadsheeteditor/embed/index.html.deploy b/apps/spreadsheeteditor/embed/index.html.deploy index 5df04d77f..cd9963855 100644 --- a/apps/spreadsheeteditor/embed/index.html.deploy +++ b/apps/spreadsheeteditor/embed/index.html.deploy @@ -225,7 +225,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index b9a1b3aec..26d24a332 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -320,7 +320,7 @@ define([ value = Common.localStorage.getItem("sse-settings-func-locale"); if (value===null) { - var lang = ((this.editorConfig.lang) ? this.editorConfig.lang : 'en').split("-")[0].toLowerCase(); + var lang = ((this.editorConfig.lang) ? this.editorConfig.lang : 'en').split(/[\-\_]/)[0].toLowerCase(); Common.Utils.InternalSettings.set("sse-settings-func-locale", lang); if (lang !== 'en') value = SSE.Views.FormulaLang.get(lang); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index efea90e92..cfd9b87ab 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -732,7 +732,7 @@ define([ value = Common.Utils.InternalSettings.get("sse-settings-func-locale"); item = this.cmbFuncLocale.store.findWhere({value: value}); if (!item) - item = this.cmbFuncLocale.store.findWhere({value: value.split("-")[0]}); + item = this.cmbFuncLocale.store.findWhere({value: value.split(/[\-\_]/)[0]}); this.cmbFuncLocale.setValue(item ? item.get('value') : 'en'); this.updateFuncExample(item ? item.get('exampleValue') : this.txtExampleEn); @@ -1304,7 +1304,7 @@ define([ var me = this; var store = this.viewHelpPicker.store; if (lang) { - lang = lang.split("-")[0]; + lang = lang.split(/[\-\_]/)[0]; var config = { dataType: 'json', error: function () { diff --git a/apps/spreadsheeteditor/main/index.html b/apps/spreadsheeteditor/main/index.html index ebd1280e2..3028a402e 100644 --- a/apps/spreadsheeteditor/main/index.html +++ b/apps/spreadsheeteditor/main/index.html @@ -217,7 +217,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/spreadsheeteditor/main/index.html.deploy b/apps/spreadsheeteditor/main/index.html.deploy index bf64e4594..7a3c4e9d5 100644 --- a/apps/spreadsheeteditor/main/index.html.deploy +++ b/apps/spreadsheeteditor/main/index.html.deploy @@ -217,7 +217,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddFunction.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddFunction.js index eb584ee89..2fa613f48 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddFunction.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddFunction.js @@ -87,7 +87,7 @@ define([ _.defer(function () { var editorLang = SSE.getController("Main").editorConfig.lang; - editorLang = (editorLang ? editorLang : 'en').split("-")[0].toLowerCase(); + editorLang = (editorLang ? editorLang : 'en').split(/[\-\_]/)[0].toLowerCase(); var localizationFunctions = function(data) { fc = data; @@ -108,7 +108,7 @@ define([ functions = {}, editorLang = SSE.getController("Main").editorConfig.lang; - editorLang = (editorLang ? editorLang : 'en').split("-")[0].toLowerCase(); + editorLang = (editorLang ? editorLang : 'en').split(/[\-\_]/)[0].toLowerCase(); var localizationFunctionsDesc = function (data) { var jsonDesc = {}, diff --git a/apps/spreadsheeteditor/mobile/index.html b/apps/spreadsheeteditor/mobile/index.html index 52dac4b0a..3bab4e071 100644 --- a/apps/spreadsheeteditor/mobile/index.html +++ b/apps/spreadsheeteditor/mobile/index.html @@ -207,7 +207,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...', diff --git a/apps/spreadsheeteditor/mobile/index.html.deploy b/apps/spreadsheeteditor/mobile/index.html.deploy index 1f9c6dfad..d41ac3ae5 100644 --- a/apps/spreadsheeteditor/mobile/index.html.deploy +++ b/apps/spreadsheeteditor/mobile/index.html.deploy @@ -204,7 +204,7 @@ } var params = getUrlParams(), - lang = (params["lang"] || 'en').split("-")[0], + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], customer = params["customer"] ? ('
' + encodeUrlParam(params["customer"]) + '
') : '', margin = (customer !== '') ? 50 : 20, loading = 'Loading...',