I have implement the Multiple Language using the Language Helper.I am loading the helper on drop-down change, means when user select any language then I load library according then. My problem is that if no language file found then it shows error
Unable to load the requested language file: language/abc/abc_lang.php
I want that if no file found then Simple English select. So I try this code but getting same error
$language = $_POST['language'];
if(($this->lang->load($language,$language)) == 1){
$this->lang->load($language,$language);
}
else{
$this->lang->load('english','english');
}
Anyone can tell me how to solve it.
Error message is triggered by your attempt to load a non-existing language file in your conditional statement. I would recommend you checking if the language file exists before trying to load it:
if (file_exists(APPPATH."language/".$expectedLanguage."/".$expectedFile)) {
$this->lang->load($expectedFile, $expectedLanguage);
}
You have to ensure that, how many option you have in drop-down that number of lang file you have to create on languages folder. then it will get its expected lang file as per you change from drop-down and not show error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.