diff --git a/apps/common/mobile/lib/controller/Plugins.jsx b/apps/common/mobile/lib/controller/Plugins.jsx index 146407841..f17c4dc12 100644 --- a/apps/common/mobile/lib/controller/Plugins.jsx +++ b/apps/common/mobile/lib/controller/Plugins.jsx @@ -182,7 +182,31 @@ const PluginsController = inject('storeAppOptions')(observer(props => { const onPluginsInit = pluginsdata => { !(pluginsdata instanceof Array) && (pluginsdata = pluginsdata["pluginsData"]); - registerPlugins(pluginsdata) + parsePlugins(pluginsdata) + }; + + const parsePlugins = pluginsdata => { + let isEdit = storeAppOptions.isEdit; + + if ( pluginsdata instanceof Array ) { + let lang = storeAppOptions.lang.split(/[\-_]/)[0]; + pluginsdata.forEach((item) => { + item.variations.forEach( (itemVar) => { + let description = itemVar.description; + if (typeof itemVar.descriptionLocale == 'object') + description = itemVar.descriptionLocale[lang] || itemVar.descriptionLocale['en'] || description || ''; + + if(itemVar.buttons !== undefined) { + itemVar.buttons.forEach( (button) => { + if (typeof button.textLocale == 'object') + button.text = button.textLocale[lang] || button.textLocale['en'] || button.text || ''; + button.visible = (isEdit || button.isViewer !== false); + }) + } + }) + }); + } + registerPlugins(pluginsdata); }; const registerPlugins = plugins => { @@ -194,6 +218,7 @@ const PluginsController = inject('storeAppOptions')(observer(props => { plugin.set_Name(item['name']); plugin.set_Guid(item['guid']); plugin.set_BaseUrl(item['baseUrl']); + plugin.set_MinVersion && plugin.set_MinVersion(item.get('minVersion')); let variations = item['variations'], variationsArr = []; @@ -245,7 +270,7 @@ const PluginsController = inject('storeAppOptions')(observer(props => { arr = arr.concat(plugins.plugins); } - registerPlugins(arr); + parsePlugins(arr); } };