diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-04-27 10:55:53 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-04-27 10:55:53 +0200 |
commit | ced2c9ab41450cb632c042730604111ec2a24e1f (patch) | |
tree | 32433143610df1683131dba5cf4437ddadc306c6 /system/core | |
parent | 61318a2c53c13a314f483fcbbfd64c6e01f5242c (diff) | |
parent | ce747c8a1e72a30f5369de7d56ba91b72f0e2eb3 (diff) |
Merge pull request #993 from narfbg/develop-issue-128
Fix issue #128
Diffstat (limited to 'system/core')
-rwxr-xr-x | system/core/Lang.php | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/system/core/Lang.php b/system/core/Lang.php index 2963012fc..5cb0cad71 100755 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -42,7 +42,7 @@ class CI_Lang { * @var array */ public $language = array(); - + /** * List of loaded language files * @@ -52,6 +52,8 @@ class CI_Lang { /** * Initialize language class + * + * @return void */ public function __construct() { @@ -76,22 +78,20 @@ class CI_Lang { if ($add_suffix == TRUE) { - $langfile = str_replace('_lang.', '', $langfile).'_lang'; + $langfile = str_replace('_lang', '', $langfile).'_lang'; } $langfile .= '.php'; - if (in_array($langfile, $this->is_loaded, TRUE)) + if ($idiom == '') { - return; + $config =& get_config(); + $idiom = ( ! empty($config['language'])) ? $config['language'] : 'english'; } - $config =& get_config(); - - if ($idiom == '') + if ($return == FALSE && isset($this->is_loaded[$langfile]) && $this->is_loaded[$langfile] === $idiom) { - $deft_lang = ( ! isset($config['language'])) ? 'english' : $config['language']; - $idiom = ($deft_lang == '') ? 'english' : $deft_lang; + return; } // Determine where the language file is and load it @@ -123,6 +123,11 @@ class CI_Lang { if ( ! isset($lang) OR ! is_array($lang)) { log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); + + if ($return == TRUE) + { + return array(); + } return; } @@ -131,9 +136,8 @@ class CI_Lang { return $lang; } - $this->is_loaded[] = $langfile; + $this->is_loaded[$langfile] = $idiom; $this->language = array_merge($this->language, $lang); - unset($lang); log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile); return TRUE; |