summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsystem/core/Lang.php26
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 14 insertions, 13 deletions
diff --git a/system/core/Lang.php b/system/core/Lang.php
index 9ef76f4d6..1616f5c7a 100755
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* Language Class
*
@@ -74,22 +72,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 +117,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 +130,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 +161,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
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index ed0b710c3..71e5ce894 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -163,6 +163,7 @@ Bug fixes for 3.0
- Fixed a bug (#501) - set_rules() to check if the request method is not 'POST' before aborting, instead of depending on count($_POST) in the :doc:`Form Validation Library <libraries/form_validation>`.
- Fixed a bug (#940) - csrf_verify() used to set the CSRF cookie while processing a POST request with no actual POST data, which resulted in validating a request that should be considered invalid.
- Fixed a bug in PostgreSQL's escape_str() where it didn't properly escape LIKE wild characters.
+- Fixed a bug (#128) - :doc:`Language Library <libraries/language>` did not correctly keep track of loaded language files.
Version 2.1.1
=============