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.
Asked
Active
Viewed 1,967 times
1
-
2You can create using codeigniter user guide. refer : http://codeigniter.com/user_guide/libraries/language.html – Balaji Kandasamy Nov 23 '12 at 06:39
-
Then try this [http://stackoverflow.com/questions/1328420/the-best-way-to-make-codeigniter-website-multi-language-calling-from-lang-array] – iLaYa ツ Nov 23 '12 at 06:41
-
You mean are you storing different record for different language? – iLaYa ツ Nov 23 '12 at 06:51
-
I referred this doc http://codeigniter.com/userguide3/libraries/language.html – Amit Kumar PRO Nov 23 '21 at 15:08
1 Answers
0
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.
Regards
iijb
-
i have to add so many languages. and messages from users have to change into different languages. so i cant predetermine all words. So how can i do it – Sona Rijesh Dec 07 '12 at 09:40