1

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.

Sona Rijesh
  • 1,041
  • 7
  • 32
  • 62

1 Answers1

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.

the best way to make codeigniter website multi-language. calling from lang arrays depends on lang session?

Regards

iijb

Community
  • 1
  • 1
iijb
  • 222
  • 3
  • 12
  • 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