1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
5 * An open source application development framework for PHP 4.3.2 or newer
8 * @author ExpressionEngine Dev Team
9 * @copyright Copyright (c) 2008 - 2009, EllisLab, Inc.
10 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
16 // ------------------------------------------------------------------------
21 * @package CodeIgniter
22 * @subpackage Libraries
24 * @author ExpressionEngine Dev Team
25 * @link http://codeigniter.com/user_guide/libraries/language.html
29 var $language = array();
30 var $is_loaded = array();
37 function CI_Language()
39 log_message('debug', "Language Class Initialized");
42 // --------------------------------------------------------------------
45 * Load a language file
48 * @param mixed the name of the language file to be loaded. Can be an array
49 * @param string the language (english, etc.)
52 function load($langfile = '', $idiom = '', $return = FALSE)
54 $langfile = str_replace(EXT, '', str_replace('_lang.', '', $langfile)).'_lang'.EXT;
56 if (in_array($langfile, $this->is_loaded, TRUE))
63 $CI =& get_instance();
64 $deft_lang = $CI->config->item('language');
65 $idiom = ($deft_lang == '') ? 'english' : $deft_lang;
68 // Determine where the language file is and load it
69 if (file_exists(APPPATH.'language/'.$idiom.'/'.$langfile))
71 include(APPPATH.'language/'.$idiom.'/'.$langfile);
75 if (file_exists(BASEPATH.'language/'.$idiom.'/'.$langfile))
77 include(BASEPATH.'language/'.$idiom.'/'.$langfile);
81 show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile);
87 log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile);
96 $this->is_loaded[] = $langfile;
97 $this->language = array_merge($this->language, $lang);
100 log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile);
104 // --------------------------------------------------------------------
107 * Fetch a single line of text from the language array
110 * @param string $line the language line
113 function line($line = '')
115 $line = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];
120 // END Language Class
122 /* End of file Language.php */
123 /* Location: ./system/libraries/Language.php */