Welcome Guest, Not a member yet? Register   Sign In
CI language handling


I am a noob to CI and php generally. I am however writing a website that will have content that mostly should stay the same that needs to be in different languages.

I am confused what the best practice for this is…

1. Should I have the content of each page in language text files and use the CI language function? OR
2. Should I have the content in a database with different columns/fields for the different languages? OR
3. Should i have the content in different databases for each language?

It must be something that a million people have had to do but I’m not sure what is the best way…also what happens with things like headers and footers, etc??

Many thanks for anyone taking the time to help


(This post was last modified: 11-02-2014, 04:25 PM by ivantcholakov.)

1. You need language files for each language. The language strings translate the user interface mainly. Except your custom language file(s) you need to have translations the CodeIgniter language files.

2., 3. About the database structure: This link explains and compares possible approaches http://www.apphp.com/tutorials/index.php...n-in-mysql . I personally like "4. Additional Translation Table Approach".

Also you have to think about data entry for the different languages, if you have an administration panel, you would need sort of multi-language CRUD. And if you store site settings within the database, you would have to find a way how it would be done for language-sensitive ones.

All these things are challenging and time consuming, not for "noobs". On the other hand, you wrote that your site would be simple. I would like to propose you first to have a look at CMS that supports multiple languages - http://ionizecms.com/ (it still uses CodeIgniter 2), and then to decide whether to code from scratch or to find/use a ready yet solution.

well on a quick google search i found this, a couple years old now but it should still work :



It is not about translation by human beings. :-) For specific purposes this "GTranslate" could be used, be aware however about the restrictions of GNU GPL v3 license.

Theme © iAndrew 2016 - Forum software by © MyBB