Add translation for plugins name and description
This commit is contained in:
parent
77e5116475
commit
7a7e4a7a50
|
@ -2088,7 +2088,8 @@ define([
|
||||||
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
|
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
|
||||||
isEdit = this.appOptions.isEdit;
|
isEdit = this.appOptions.isEdit;
|
||||||
if (plugins) {
|
if (plugins) {
|
||||||
var arr = [], arrUI = [];
|
var arr = [], arrUI = [],
|
||||||
|
lang = this.appOptions.lang.split(/[\-\_]/)[0];
|
||||||
plugins.pluginsData.forEach(function(item){
|
plugins.pluginsData.forEach(function(item){
|
||||||
if (_.find(arr, function(arritem) {
|
if (_.find(arr, function(arritem) {
|
||||||
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
|
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
|
||||||
|
@ -2105,8 +2106,12 @@ define([
|
||||||
visible && arrUI.push(item.baseUrl + itemVar.url);
|
visible && arrUI.push(item.baseUrl + itemVar.url);
|
||||||
} else {
|
} else {
|
||||||
var model = new Common.Models.PluginVariation(itemVar);
|
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({
|
model.set({
|
||||||
|
description: description,
|
||||||
index: variationsArr.length,
|
index: variationsArr.length,
|
||||||
url: itemVar.url,
|
url: itemVar.url,
|
||||||
icons: itemVar.icons,
|
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({
|
arr.push(new Common.Models.Plugin({
|
||||||
name : item.name,
|
name : name,
|
||||||
guid: item.guid,
|
guid: item.guid,
|
||||||
baseUrl : item.baseUrl,
|
baseUrl : item.baseUrl,
|
||||||
variations: variationsArr,
|
variations: variationsArr,
|
||||||
|
@ -2128,6 +2137,7 @@ define([
|
||||||
groupName: (item.group) ? item.group.name : '',
|
groupName: (item.group) ? item.group.name : '',
|
||||||
groupRank: (item.group) ? item.group.rank : 0
|
groupRank: (item.group) ? item.group.rank : 0
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( uiCustomize!==false ) // from ui customizer in editor config or desktop event
|
if ( uiCustomize!==false ) // from ui customizer in editor config or desktop event
|
||||||
|
|
|
@ -1834,7 +1834,8 @@ define([
|
||||||
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
|
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
|
||||||
isEdit = this.appOptions.isEdit;
|
isEdit = this.appOptions.isEdit;
|
||||||
if (plugins) {
|
if (plugins) {
|
||||||
var arr = [], arrUI = [];
|
var arr = [], arrUI = [],
|
||||||
|
lang = this.appOptions.lang.split(/[\-\_]/)[0];
|
||||||
plugins.pluginsData.forEach(function(item){
|
plugins.pluginsData.forEach(function(item){
|
||||||
if (_.find(arr, function(arritem) {
|
if (_.find(arr, function(arritem) {
|
||||||
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
|
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
|
||||||
|
@ -1851,8 +1852,12 @@ define([
|
||||||
visible && arrUI.push(item.baseUrl + itemVar.url);
|
visible && arrUI.push(item.baseUrl + itemVar.url);
|
||||||
} else {
|
} else {
|
||||||
var model = new Common.Models.PluginVariation(itemVar);
|
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({
|
model.set({
|
||||||
|
description: description,
|
||||||
index: variationsArr.length,
|
index: variationsArr.length,
|
||||||
url: itemVar.url,
|
url: itemVar.url,
|
||||||
icons: itemVar.icons,
|
icons: itemVar.icons,
|
||||||
|
@ -1862,9 +1867,13 @@ define([
|
||||||
variationsArr.push(model);
|
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({
|
arr.push(new Common.Models.Plugin({
|
||||||
name : item.name,
|
name : name,
|
||||||
guid: item.guid,
|
guid: item.guid,
|
||||||
baseUrl : item.baseUrl,
|
baseUrl : item.baseUrl,
|
||||||
variations: variationsArr,
|
variations: variationsArr,
|
||||||
|
@ -1873,6 +1882,7 @@ define([
|
||||||
groupName: (item.group) ? item.group.name : '',
|
groupName: (item.group) ? item.group.name : '',
|
||||||
groupRank: (item.group) ? item.group.rank : 0
|
groupRank: (item.group) ? item.group.rank : 0
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (uiCustomize!==false) // from ui customizer in editor config or desktop event
|
if (uiCustomize!==false) // from ui customizer in editor config or desktop event
|
||||||
|
|
|
@ -2027,7 +2027,8 @@ define([
|
||||||
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
|
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
|
||||||
isEdit = this.appOptions.isEdit;
|
isEdit = this.appOptions.isEdit;
|
||||||
if (plugins) {
|
if (plugins) {
|
||||||
var arr = [], arrUI = [];
|
var arr = [], arrUI = [],
|
||||||
|
lang = this.appOptions.lang.split(/[\-\_]/)[0];
|
||||||
plugins.pluginsData.forEach(function(item){
|
plugins.pluginsData.forEach(function(item){
|
||||||
if (_.find(arr, function(arritem) {
|
if (_.find(arr, function(arritem) {
|
||||||
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
|
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
|
||||||
|
@ -2044,8 +2045,12 @@ define([
|
||||||
visible && arrUI.push(item.baseUrl + itemVar.url);
|
visible && arrUI.push(item.baseUrl + itemVar.url);
|
||||||
} else {
|
} else {
|
||||||
var model = new Common.Models.PluginVariation(itemVar);
|
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({
|
model.set({
|
||||||
|
description: description,
|
||||||
index: variationsArr.length,
|
index: variationsArr.length,
|
||||||
url: itemVar.url,
|
url: itemVar.url,
|
||||||
icons: itemVar.icons,
|
icons: itemVar.icons,
|
||||||
|
@ -2055,9 +2060,13 @@ define([
|
||||||
variationsArr.push(model);
|
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({
|
arr.push(new Common.Models.Plugin({
|
||||||
name : item.name,
|
name : name,
|
||||||
guid: item.guid,
|
guid: item.guid,
|
||||||
baseUrl : item.baseUrl,
|
baseUrl : item.baseUrl,
|
||||||
variations: variationsArr,
|
variations: variationsArr,
|
||||||
|
@ -2066,6 +2075,7 @@ define([
|
||||||
groupName: (item.group) ? item.group.name : '',
|
groupName: (item.group) ? item.group.name : '',
|
||||||
groupRank: (item.group) ? item.group.rank : 0
|
groupRank: (item.group) ? item.group.rank : 0
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (uiCustomize!==false) // from ui customizer in editor config or desktop event
|
if (uiCustomize!==false) // from ui customizer in editor config or desktop event
|
||||||
|
|
Loading…
Reference in a new issue