summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2007-07-12 14:14:45 +0200
committerDerek Allard <derek.allard@ellislab.com>2007-07-12 14:14:45 +0200
commitc9e2b10f08a3c718e52e287e2dd14b880e4e3057 (patch)
treeec92a77963e8677ef6b0b270ae3e954717f2a49d /system
parent2d2437edf10edf2669dd85e5943bd4061216eef0 (diff)
added language files to autoload
Diffstat (limited to 'system')
-rw-r--r--system/application/config/autoload.php15
-rw-r--r--system/libraries/Language.php5
-rw-r--r--system/libraries/Loader.php25
3 files changed, 33 insertions, 12 deletions
diff --git a/system/application/config/autoload.php b/system/application/config/autoload.php
index 26e71f74c..85b65aa7f 100644
--- a/system/application/config/autoload.php
+++ b/system/application/config/autoload.php
@@ -82,6 +82,21 @@ $autoload['config'] = array();
/*
| -------------------------------------------------------------------
+| Auto-load Language files
+| -------------------------------------------------------------------
+| Prototype:
+|
+| $autoload['language'] = array('lang1', 'lang2');
+|
+| NOTE: Do not include the "_lang" part of your file. For example
+| "codeigniter_lang.php" would be referenced as array('codeigniter');
+|
+*/
+
+$autoload['language'] = array('');
+
+/*
+| -------------------------------------------------------------------
| Auto-load Core Libraries
| -------------------------------------------------------------------
|
diff --git a/system/libraries/Language.php b/system/libraries/Language.php
index 26775ec7e..94923a3e7 100644
--- a/system/libraries/Language.php
+++ b/system/libraries/Language.php
@@ -89,11 +89,6 @@ class CI_Language {
return;
}
- if ($return == TRUE)
- {
- return $lang;
- }
-
$this->is_loaded[] = $langfile;
$this->language = array_merge($this->language, $lang);
unset($lang);
diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php
index abe3a1c37..7fa46c3ad 100644
--- a/system/libraries/Loader.php
+++ b/system/libraries/Loader.php
@@ -481,13 +481,24 @@ class CI_Loader {
* Loads a language file
*
* @access public
+ * @param array
* @param string
+ * @param bool
* @return void
*/
- function language($file = '', $lang = '', $return = FALSE)
+ function language($file = array(), $lang = '')
{
$CI =& get_instance();
- return $CI->lang->load($file, $lang, $return);
+
+ if ( ! is_array($file))
+ {
+ $file = array($file);
+ }
+
+ foreach ($file as $langfile)
+ {
+ $CI->lang->load($langfile, $lang);
+ }
}
// --------------------------------------------------------------------
@@ -813,7 +824,7 @@ class CI_Loader {
return FALSE;
}
- // Load any custome config file
+ // Load any custom config file
if (count($autoload['config']) > 0)
{
$CI =& get_instance();
@@ -823,15 +834,15 @@ class CI_Loader {
}
}
- // Load plugins, helpers, and scripts
- foreach (array('helper', 'plugin', 'script') as $type)
- {
+ // Autoload plugins, helpers, scripts and languages
+ foreach (array('helper', 'plugin', 'script', 'language') as $type)
+ {
if (isset($autoload[$type]) AND count($autoload[$type]) > 0)
{
$this->$type($autoload[$type]);
}
}
-
+
// A little tweak to remain backward compatible
// The $autoload['core'] item was deprecated
if ( ! isset($autoload['libraries']))