CodeIgniter Forums
Creating multilanguage site - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Creating multilanguage site (/showthread.php?tid=67129)



Creating multilanguage site - rannt - 01-18-2017

Hi!

I'm familiar with lang helper and lang library, but I was wondering if there is a better way to do this. I don't really like the fact, that my views are a bunch of html code containing nothing but variables.

Is there a solution where a view would contain actual text and the CI would recognize that text when loading the view and changed the text according to user language setting? I know I could create multiple versions of the same view (one for every language), but that would mean making changes to the same html code in multiple places, which is again a bad idea.

Thank you!


RE: Creating multilanguage site - Diederik - 01-18-2017

No I'm sorry, you get the idea perfectly. You either use variables in your views so it's all dynamic, or use more static views. Personaly I use dynamic views with almost the full english words/sentices put in the language helper function. That helps making the view file more readable.


RE: Creating multilanguage site - bkader - 01-30-2017

Hi.
You can try my library that uses PHP gttext may be it can help you

https://forum.codeigniter.com/thread-66236.html