Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic multi language site in CodeIgniter. Best approach?

The scenario:

The client wants a website that is multilingual. The content does not remain static and needs to be edited via the CMS. Additional languages can be added at any time.

Using CodeIgniter's lanuage helper function is not an option from what I can tell, as it relies on static content.

Before I potentially reinvent the wheel and write my own helper. Is there some existing functionality available? I am relatively new to CodeIgniter, so forgive my ignorance.

I have searched and all answers come back with "use language helper".

like image 816
Ben Harvey Avatar asked Apr 06 '26 22:04

Ben Harvey


1 Answers

So, I found this extension on EllisLab's GitHub page and I think it'll do what I want.

https://github.com/EllisLab/CodeIgniter/wiki/Language-Class-Extended-DB

From the page:

This is more or less an example on how to extend the core language class to fetch language lines from a database if the language file doesn't exist.

Works identically the same as the existing core class with no extra params required.

Everything you'll need or need to know is in the code comments. Enjoy... feel free to expand on it and repost it, or whatever.

Hope it helps someone in the same situation.

like image 199
Ben Harvey Avatar answered Apr 09 '26 12:04

Ben Harvey