Hi,
I need help...
I would like to load the corresponding language only once... not on every function call. Why $language variable is not visible when it's placed globally in file? Sorry if this is obvious but I'm not php developer...
When do this variable get set? Seems like really late that's why I can't access its value...
I need help...
PHP Code:
<?php
# get correct id for plugin
$pluginName=basename(__FILE__, ".php");
# add in this plugin's language file
global $language;
i18n_merge($pluginName) || i18n_merge($pluginName, $language); // this is not working... it's returning nothing
# some stuff here...
function get_translation($field) {
global $pluginName, $language;
i18n_merge($pluginName) || i18n_merge($pluginName, $language); // <-- here $language is visible and returning correct value for current language
return i18n($pluginName . '/' . $field);
}
?>
When do this variable get set? Seems like really late that's why I can't access its value...