DOC SYSTEM I added functions to load translations of plugins SOLVED

I added functions to load translations of plugins
This commit is contained in:
Brayan Osmar Pereyra Suxo
2013-03-13 11:15:43 -04:00
parent c11eee2c17
commit 20e8ba24d4
2 changed files with 32 additions and 0 deletions

View File

@@ -834,6 +834,36 @@ class Bootstrap
return true; return true;
} }
/**
* Function LoadTranslationPlugins
* It generates a global Translation variable for plugins
*
* Per script
*
* @author Brayan Pereyra <cochalo>. <brayan@colosa.com>
* @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 * Render Page
* *

View File

@@ -582,6 +582,8 @@ $oPluginRegistry = & PMPluginRegistry::getSingleton();
if (file_exists( $sSerializedFile )) { if (file_exists( $sSerializedFile )) {
$oPluginRegistry->unSerializeInstance( file_get_contents( $sSerializedFile ) ); $oPluginRegistry->unSerializeInstance( file_get_contents( $sSerializedFile ) );
$attributes = $oPluginRegistry->getAttributes();
Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes);
} }
// setup propel definitions and logging // setup propel definitions and logging