! -> Note
$ -> Affected files
+08-Nov-2010 Janusz Dobrowolski
+# Fixed support for report translations in extension modules
+$ /includes/main.inc
+ /reporting/includes/class.pdf.inc
+
07-Nov-2010 Janusz Dobrowolski
! Separate class for view and print/email links (also fixes conflict with confirmation dialog)
$ /includes/ui/ui_controls.inc
/*
Search for file, looking first for company specific version, then for
version provided by any extension module, finally in main FA directory.
- Also adds include path for any related files.
+ Also adds include path for any related files, and sets $local_path_to_root
+ to enable local translation domains.
Returns found file path or null.
*/
function find_custom_file($rep)
{
- global $installed_extensions, $path_to_root;
+ global $installed_extensions, $path_to_root, $local_path_to_root;
// customized per company version
$path = company_path();
$file = $path.$rep;
if (file_exists($file)) {
// add local include path
+ $local_path_to_root = $path;
set_include_path(dirname($file).PATH_SEPARATOR.get_include_path());
return $file;
}
$extensions = $installed_extensions;
foreach ($extensions as $ext)
if (($ext['active'] && $ext['type'] == 'extension')) {
+ $local_path_to_root =
$path = $path_to_root.'/'.$ext['path'];
$file = $path.$rep;
if (file_exists($file)) {
*/
function SetLang($code=null)
{
- global $installed_languages, $dflt_lang, $path_to_root;
+ global $installed_languages, $dflt_lang, $path_to_root, $local_path_to_root;
if (!$code)
$code = $dflt_lang;
$lang = array_search_value($code, $installed_languages, 'code');
$_SESSION['get_text']->set_language($lang['code'], strtoupper($lang['encoding']));
- $_SESSION['get_text']->add_domain($lang['code'], $path_to_root . "/lang", @$lang['version']);
+ // $local_path_to_root is set inside find_custom_file.
+ // Select extension domain if po file is provided
+ // otherwise use global translation.
+ if (file_exists($local_path_to_root.'/lang/'.$lang['code'].'/LC_MESSAGES/'.$lang['code'].'.po'))
+ $_SESSION['get_text']->add_domain($lang['code'], $local_path_to_root . "/lang");
+ else
+ $_SESSION['get_text']->add_domain($lang['code'], $path_to_root . "/lang", @$lang['version']);
// re-read translated sys names.
include($path_to_root.'/includes/sysnames.inc');