Add translation for plugins name and description

This commit is contained in:
Julia Radzhabova 2018-11-02 11:37:10 +03:00
parent 77e5116475
commit 7a7e4a7a50
3 changed files with 39 additions and 9 deletions

View file

@ -2088,7 +2088,8 @@ define([
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
isEdit = this.appOptions.isEdit;
if (plugins) {
var arr = [], arrUI = [];
var arr = [], arrUI = [],
lang = this.appOptions.lang.split(/[\-\_]/)[0];
plugins.pluginsData.forEach(function(item){
if (_.find(arr, function(arritem) {
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
@ -2105,8 +2106,12 @@ define([
visible && arrUI.push(item.baseUrl + itemVar.url);
} else {
var model = new Common.Models.PluginVariation(itemVar);
var description = itemVar.description;
if (typeof itemVar.descriptionLocale == 'object')
description = itemVar.descriptionLocale[lang] || itemVar.descriptionLocale['en'] || description || '';
model.set({
description: description,
index: variationsArr.length,
url: itemVar.url,
icons: itemVar.icons,
@ -2117,9 +2122,13 @@ define([
}
});
if (variationsArr.length>0 && !item.isUICustomizer)
if (variationsArr.length>0 && !item.isUICustomizer) {
var name = item.name;
if (typeof item.nameLocale == 'object')
name = item.nameLocale[lang] || item.nameLocale['en'] || name || '';
arr.push(new Common.Models.Plugin({
name : item.name,
name : name,
guid: item.guid,
baseUrl : item.baseUrl,
variations: variationsArr,
@ -2128,6 +2137,7 @@ define([
groupName: (item.group) ? item.group.name : '',
groupRank: (item.group) ? item.group.rank : 0
}));
}
});
if ( uiCustomize!==false ) // from ui customizer in editor config or desktop event

View file

@ -1834,7 +1834,8 @@ define([
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
isEdit = this.appOptions.isEdit;
if (plugins) {
var arr = [], arrUI = [];
var arr = [], arrUI = [],
lang = this.appOptions.lang.split(/[\-\_]/)[0];
plugins.pluginsData.forEach(function(item){
if (_.find(arr, function(arritem) {
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
@ -1851,8 +1852,12 @@ define([
visible && arrUI.push(item.baseUrl + itemVar.url);
} else {
var model = new Common.Models.PluginVariation(itemVar);
var description = itemVar.description;
if (typeof itemVar.descriptionLocale == 'object')
description = itemVar.descriptionLocale[lang] || itemVar.descriptionLocale['en'] || description || '';
model.set({
description: description,
index: variationsArr.length,
url: itemVar.url,
icons: itemVar.icons,
@ -1862,9 +1867,13 @@ define([
variationsArr.push(model);
}
});
if (variationsArr.length>0 && !item.isUICustomizer)
if (variationsArr.length>0 && !item.isUICustomizer) {
var name = item.name;
if (typeof item.nameLocale == 'object')
name = item.nameLocale[lang] || item.nameLocale['en'] || name || '';
arr.push(new Common.Models.Plugin({
name : item.name,
name : name,
guid: item.guid,
baseUrl : item.baseUrl,
variations: variationsArr,
@ -1873,6 +1882,7 @@ define([
groupName: (item.group) ? item.group.name : '',
groupRank: (item.group) ? item.group.rank : 0
}));
}
});
if (uiCustomize!==false) // from ui customizer in editor config or desktop event

View file

@ -2027,7 +2027,8 @@ define([
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
isEdit = this.appOptions.isEdit;
if (plugins) {
var arr = [], arrUI = [];
var arr = [], arrUI = [],
lang = this.appOptions.lang.split(/[\-\_]/)[0];
plugins.pluginsData.forEach(function(item){
if (_.find(arr, function(arritem) {
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
@ -2044,8 +2045,12 @@ define([
visible && arrUI.push(item.baseUrl + itemVar.url);
} else {
var model = new Common.Models.PluginVariation(itemVar);
var description = itemVar.description;
if (typeof itemVar.descriptionLocale == 'object')
description = itemVar.descriptionLocale[lang] || itemVar.descriptionLocale['en'] || description || '';
model.set({
description: description,
index: variationsArr.length,
url: itemVar.url,
icons: itemVar.icons,
@ -2055,9 +2060,13 @@ define([
variationsArr.push(model);
}
});
if (variationsArr.length>0 && !item.isUICustomizer)
if (variationsArr.length>0 && !item.isUICustomizer) {
var name = item.name;
if (typeof item.nameLocale == 'object')
name = item.nameLocale[lang] || item.nameLocale['en'] || name || '';
arr.push(new Common.Models.Plugin({
name : item.name,
name : name,
guid: item.guid,
baseUrl : item.baseUrl,
variations: variationsArr,
@ -2066,6 +2075,7 @@ define([
groupName: (item.group) ? item.group.name : '',
groupRank: (item.group) ? item.group.rank : 0
}));
}
});
if (uiCustomize!==false) // from ui customizer in editor config or desktop event