X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Flang%2Flanguage.php;h=1ec47d17766321e07abd07f3c808d3337e4622b3;hb=b611def496e4942321d66f183fe0e1d95417c99f;hp=8960928377024f8071c6cf0e0b1dfaaab1eb4e29;hpb=9dab04be9d81766f1878d3688ee73d0bcf29f5d2;p=fa-stable.git diff --git a/includes/lang/language.php b/includes/lang/language.php index 89609283..1ec47d17 100644 --- a/includes/lang/language.php +++ b/includes/lang/language.php @@ -22,12 +22,15 @@ class language var $encoding; // eg. UTF-8, CP1256, ISO8859-1 var $dir; // Currently support for Left-to-Right (ltr) and // Right-To-Left (rtl) + var $version; // lang package version var $is_locale_file; function language($name, $code, $encoding, $dir = 'ltr') { + global $dflt_lang; + $this->name = $name; - $this->code = $code; + $this->code = $code ? $code : ($dflt_lang ? $dflt_lang : 'en_GB'); $this->encoding = $encoding; $this->dir = $dir; } @@ -45,26 +48,27 @@ class language function set_language($code) { - global $comp_path, $path_to_root, $installed_languages; + global $path_to_root, $installed_languages; - $changed = $this->code != $code; $lang = array_search_value($code, $installed_languages, 'code'); + $changed = $this->code != $code || $this->version != @$lang['version']; if ($lang && $changed) { // flush cache as we can use several languages in one account - flush_dir($comp_path.'/'.user_company().'/js_cache'); + flush_dir(company_path().'/js_cache'); $this->name = $lang['name']; $this->code = $lang['code']; $this->encoding = $lang['encoding']; + $this->version = @$lang['version']; $this->dir = isset($lang['rtl']) ? 'rtl' : 'ltr'; $locale = $path_to_root . "/lang/" . $this->code . "/locale.inc"; $this->is_locale_file = file_exists($locale); } $_SESSION['get_text']->set_language($this->code, $this->encoding); - $_SESSION['get_text']->add_domain($this->code, $path_to_root . "/lang"); + $_SESSION['get_text']->add_domain($this->code, $path_to_root . "/lang", $this->version); // Necessary for ajax calls. Due to bug in php 4.3.10 for this // version set globally in php.ini