Support for languages with "_" separator (en_US).

This commit is contained in:
Julia Radzhabova 2018-01-24 14:40:59 +03:00
parent 5cf94b8ca9
commit b7675946f8
26 changed files with 28 additions and 28 deletions

View file

@ -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 + ")");

View file

@ -233,7 +233,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -225,7 +225,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -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 () {

View file

@ -219,7 +219,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -218,7 +218,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -206,7 +206,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -205,7 +205,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -232,7 +232,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -225,7 +225,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -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 () {

View file

@ -218,7 +218,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -218,7 +218,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -222,7 +222,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -218,7 +218,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -206,7 +206,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -205,7 +205,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -233,7 +233,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -225,7 +225,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -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);

View file

@ -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 () {

View file

@ -217,7 +217,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -217,7 +217,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -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 = {},

View file

@ -207,7 +207,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',

View file

@ -204,7 +204,7 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split("-")[0],
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
customer = params["customer"] ? ('<div class="loader-page-text-customer">' + encodeUrlParam(params["customer"]) + '</div>') : '',
margin = (customer !== '') ? 50 : 20,
loading = 'Loading...',