Welcome Guest, Not a member yet? Register   Sign In
Codeigniter Multilanguage Question
#1

[eluser]JayArias[/eluser]
Hello , I am creating a cms that will present massive amounts of news to large Latino and American groups here in the united states and in other regions of the world. My question is; is there any way/plug ins/scripts that I can use to translate the data presented on the website?

eg:
Code:
<&lt;?=anchor(''.$SITE_URL.'/en', 'English');?&gt; |&lt;?=anchor(''.$SITE_URL.'/es', 'Enspanol');?&gt;
#2

[eluser]Phil Sturgeon[/eluser]
The best way to do this is find some way of remembering what language to use, then set a constant with that language code very early on. Here you would take the last URI string (using array_pop() in a pre controller hook perhaps?) and set define('LANG_CODE', 'en') or whatever fr all of CI to see.

You cannot actually translate page content without hooking into google Translate or some other third-party lib, but you can easily have language specific content. By storing a language code in the database next to the content, you can say "SELECT * FROM news WHERE lang = 'en' or lang = ''" and you have your site accepting multi-lang.

If you need a little help with this here is a post with a few examples on how to do this.

How to make a multi country web site? (Best practices)




Theme © iAndrew 2016 - Forum software by © MyBB