From 20e8ba24d4a1ab0623b486363399eedc41bb3971 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Wed, 13 Mar 2013 11:15:43 -0400 Subject: [PATCH] DOC SYSTEM I added functions to load translations of plugins SOLVED I added functions to load translations of plugins --- gulliver/system/class.bootstrap.php | 30 +++++++++++++++++++++++++++++ workflow/public_html/sysGeneric.php | 2 ++ 2 files changed, 32 insertions(+) diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 710942f7c..24aee47b5 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -834,6 +834,36 @@ class Bootstrap return true; } + /** + * Function LoadTranslationPlugins + * It generates a global Translation variable for plugins + * + * Per script + * + * @author Brayan Pereyra . + * @access public + * @param string lang + * @param array list plugins active + * @return void + */ + public function LoadTranslationPlugins ($lang = SYS_LANG, $listPluginsActive) + { + if ( ! ( is_array ( $listPluginsActive ) ) ) { + return null; + } + + foreach ($listPluginsActive['_aPluginDetails'] as $key => $value) { + $namePlugin = trim($key); + $translation = array(); + if (file_exists(PATH_LANGUAGECONT . $namePlugin . '.' . $lang)) { + eval('global $translation'.$namePlugin.';'); + require_once (PATH_LANGUAGECONT . $namePlugin . '.' . $lang); // load the foreign translations table + eval('$translation'.$namePlugin.' = $translation;'); + } + } + return true; + } + /** * Render Page * diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index ed8a29902..9270dce25 100755 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -582,6 +582,8 @@ $oPluginRegistry = & PMPluginRegistry::getSingleton(); if (file_exists( $sSerializedFile )) { $oPluginRegistry->unSerializeInstance( file_get_contents( $sSerializedFile ) ); + $attributes = $oPluginRegistry->getAttributes(); + Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes); } // setup propel definitions and logging