How to setup CodeIgniter for a truly multi language website?

André picture André · May 24, 2011 · Viewed 17.2k times · Source

I need to setup CodeIgniter to be a truly multi language website. I've searched but I can't find a solution.

I've tested this approach but it is not working. (http://codeigniter.com/wiki/Category%3AInternationalization%3A%3AInternationalization_Views_i18n/)

Can someone give me a clue about what setup to use to get a truly multi language environment in CodeIgniter?

Best Regards,

Answer

P.T. picture P.T. · Aug 19, 2011

https://github.com/EllisLab/CodeIgniter/wiki/CodeIgniter-2.1-internationalization-i18n

If you implement this, you URLs will contain the language code. You can save your language parts in the language directory. With the function lang();

Loading language files and handling them is explained here: https://www.codeigniter.com/user_guide/libraries/language.html

The helper: https://www.codeigniter.com/user_guide/helpers/language_helper.html

Easiest way is have to some global language files which you auto load. I suggest creating a language file for every controller. So you only load the part you need instead of loading all language files.