DOC SYSTEM I added functions to load translations of plugins SOLVED
I added functions to load translations of plugins
This commit is contained in:
@@ -834,6 +834,36 @@ class Bootstrap
|
||||
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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user