How can i add multi language in codeigniter? I need my website in different languages. Languages can select from a dropdown in the header. According to the selected language, the complete website would be in selected language. Am using latest version of codeigniter.
You can use codeigniter language class even if you are taking data from db. Store language array key in db.
For eg,
in language file there is one entry
$lang['hello'] = "hello in english";
You can store hello in db and and get it as
$dbdata = 'hello';//taken from db
And use that in your controller/view as
echo $this->lang->line($dbdata);
If you have any doubt about codeigniter language class, have a look at some older posts here.
the best way to make codeigniter website multi-language. calling from lang arrays depends on lang session?
Regards
iijb
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.