summaryrefslogtreecommitdiffstats
path: root/system/core/Lang.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-04-27 11:15:47 +0200
committerAndrey Andreev <narf@bofh.bg>2012-04-27 11:15:47 +0200
commit5815dba069428514ce39e745328a898fc877773f (patch)
tree9ba5c1dc7bef0458c5f89e573f1b2acf05f3c688 /system/core/Lang.php
parent9c9591c9b4a1d7ac412f7a85aeb5c92f50aa3490 (diff)
parentced2c9ab41450cb632c042730604111ec2a24e1f (diff)
Merge upstream branch
Diffstat (limited to 'system/core/Lang.php')
-rwxr-xr-xsystem/core/Lang.php36
1 files changed, 21 insertions, 15 deletions
diff --git a/system/core/Lang.php b/system/core/Lang.php
index 9ef76f4d6..5cb0cad71 100755
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* Language Class
*
@@ -43,14 +41,20 @@ class CI_Lang {
*
* @var array
*/
- public $language = array();
+ public $language = array();
+
/**
* List of loaded language files
*
* @var array
*/
- public $is_loaded = array();
+ public $is_loaded = array();
+ /**
+ * Initialize language class
+ *
+ * @return void
+ */
public function __construct()
{
log_message('debug', 'Language Class Initialized');
@@ -74,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
@@ -121,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;
}
@@ -129,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;
@@ -161,4 +167,4 @@ class CI_Lang {
}
/* End of file Lang.php */
-/* Location: ./system/core/Lang.php */
+/* Location: ./system/core/Lang.php */ \ No newline at end of file