diff --git a/front/js/pialert_common.js b/front/js/pialert_common.js index b75f7d45..995ade83 100755 --- a/front/js/pialert_common.js +++ b/front/js/pialert_common.js @@ -162,7 +162,7 @@ function cacheStrings() }); // handle strings and translations from plugins - $.get('api/table_language_strings.json', function(res) { + $.get('api/table_plugins_language_strings.json', function(res) { data = res["data"]; @@ -193,9 +193,14 @@ function getString (key) { } result = getCache(`pia_lang_${key}_${lang_code}`, true); + if(isEmpty(result)) { + console.log(`pia_lang_${key}_${lang_code}`) + console.log(key) result = getCache(`pia_lang_${key}_en_us`, true); + console.log(result) + } return result; diff --git a/front/pluginsCore.php b/front/pluginsCore.php index a2d02324..d7e9226e 100755 --- a/front/pluginsCore.php +++ b/front/pluginsCore.php @@ -136,38 +136,6 @@ function saveData (id) { }); } -// ----------------------------------------------------------------------------- -// Get translated string -function localize (obj, key) { - - currLangCode = getCookie("language") - - result = "" - en_us = "" - - if(obj.localized && obj.localized.includes(key)) - { - for(i=0;i - - ${localize(pluginObj, 'icon')} ${localize(pluginObj, 'display_name')} + + ${getString(`${prefix}_icon`)} ${getString(`${prefix}_display_name`)} ` ); @@ -238,13 +207,14 @@ function generateTabs() evRows = "" obRows = "" hiRows = "" + prefix = pluginObj.unique_prefix; // Generate the header $.each(pluginObj["database_column_definitions"], function(index, colDef){ if(colDef.show == true) // select only the ones to show { colDefinitions.push(colDef) - headersHtml += `${localize(colDef, "name" )}` + headersHtml += `${getString(`${prefix}_${colDef.column}_name` )}` } }); @@ -252,7 +222,7 @@ function generateTabs() var eveCount = 0; for(i=0;i= 0;i--) // from latest to the oldest { - if(pluginHistory[i].Plugin == pluginObj.unique_prefix) + if(pluginHistory[i].Plugin == prefix) { if(histCount < 50) // only display 50 entries to optimize performance { @@ -293,7 +263,7 @@ function generateTabs() var obCount = 0; for(var i=0;i +