CI Framework source Reading---------lang.php
Is_loaded and $this->language go to the * @param booladd suffix to $langfile file add suffix * @param stringalternative path to looking for L Anguage Custom path for file language pack files * @returnmixed */function load ($langfile = ", $idiom =", $return = FALSE, $add _suffix = TRUE, $alt _path = ") {///langfile file. php suffix minus $langfile = str_replace ('. php ', ' ', $langfile);//Determine if you need to add a suffix if required//will _lang. Remove and then LAN Gfile after adding _langif ($add _suffix = = TRUE) {$langfile = Str_replace (' _lang. ', ', $langfile). ' _lang ';} Add. php suffix $langfile. = '. php ' for langfile,//To determine if the current file has been loaded if (In_array ($langfile, $this->is_loaded, TRUE)) {return;} Gets the data for the configuration file $config =& get_config ();//If the language you want to use is empty//Then we will get the if ($idiom = = ") from $config {$deft _lang = (! isset ($config [ ' language '))? ' 中文版 ': $config [' language ']; $idiom = ($deft _lang = = ")? ' 中文版 ': $deft _lang;} Determine where the language file is and load it//find the language pack under a custom path and load the IF ($alt _path! = "&& file_exists ($alt _path. ' language/'. $idiom. ' /'. $langfile)) {include ($alt _path. ' language/'. $idiom. ' /'.$langfile);} else{//If the custom path is not found, call Get_instance ()->load->get_package_paths (TRUE)//Look under the package path//Get_package_ Paths this function in loader.php $found = False;foreach (Get_instance ()->load->get_package_paths (TRUE) as $package _path) { if (file_exists ($package _path. ' language/' $idiom. ' /'. $langfile)) {include ($package _path. ' language/'. $idiom. ' /'. $langfile); $found = True;break;}} If you haven't found it, you can only get an error.//if ($found!== TRUE) {show_error (' Unable to load the requested language file:language/'. $idiom. ' /'. $langfile);}} if (! isset ($lang)) {log_message (' error ', ' Language file contains no data:language/'. $idiom. ' /'. $langfile); return;} if ($return = = TRUE) {return $lang;} $this->is_loaded[] = $langfile; $this->language = Array_merge ($this->language, $lang); unset ($lang); log_ Message (' Debug ', ' Language file loaded:language/'. $idiom. ' /'. $langfile); return TRUE;} --------------------------------/** * Fetch a single lines of text from the language array * Get a line of text * @accesspublic * @p Aramstring$linethe Language Line * @returnstring */function Line ($line = ') {/* * $this->language look like * $lang [' error_email_missing '] = "You must email address "; * $lang [' error_url_missing '] = "You must submit a URL"; * $lang [' error_username_missing '] = "You must submit a username"; */$value = ($line = = "OR! Isset ($this->language[$line])? FALSE: $this->language[$line];//Because killer robots like unicorns!if ($value = = = FALSE) {log_message (' error ', ' Coul D not find the language line "'. $line. ' ');} return $value;}} End Language class/* end of file lang.php *//* location:./system/core/lang.php */