Part of the EllisLab Network
   
 
Multilingual website with internalization i18n - Index page
Posted: 12 August 2011 01:41 PM   [ Ignore ]  
Summer Student
Total Posts:  5
Joined  08-01-2011

Hello,

I’m a new user with codeigniter…

First, please forgive for my poor english wink

I’m trying to do a multilingual website with the internalization i18n with codeigniter.

I have 2 links: english and french.

For example: firefox is in english (my page will translate automatically in english and my url: http://localhost:8888/mysite/en/home).
If i click on the french link, it will be automatically translate in french (url: http://localhost:8888/mysite/fr/home).
If I continue to visit my website, it will be in french (example->url: http://localhost:8888/mysite/fr/subscribe) but if i come back to my index, my language chosen (here:french) will become by the firefox default language (in my example in english).

How to keep the language chosen for all the website ?

Could you help me please?

Thanks a lot.

Profile
 
 
Posted: 13 August 2011 05:57 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  171
Joined  11-28-2008

Use sessions storage user prefs cookies or server.

 Signature 

Enough work has cost to me commit my sins
To devalue them in vain regrets.

Profile
 
 
Posted: 10 September 2011 11:22 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  5
Joined  08-01-2011

Thanks to your answer….

The problem is that i don’t know to create session storage server.

Please, may you give me an example?

Thanks a lot

Profile
 
 
Posted: 05 February 2012 11:47 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  4
Joined  02-05-2012

I needed Multi-Language support for a project I have been working on and have put the code online for everyone to enjoy:

https://github.com/benjamincurrie/CodeIgniter-Language-Switch

My main goal was to support multi-lingual search engine friendly URL’s, for example:
mysite.com/home (home page in English)
mysite.com/accueil (home page in French)

For those who take SEO seriously, having a URL that uses your keywords is a big deal and my employer at the time wanted the keywords in the URL for every language.

This does require a config file to keep track of controller and function translations, for those who don’t wish to maintain translations it reverts to URL’s like this:
mysite.com/fr/home

There is also an option to use a query string:
mysite.com/home?lang=fr

I’ve put the project up on Github and would love some feedback as I have only tested in my own environments so far. Feel free to fork the project and implement your own methods, hopefully we can get a fairly expansive library happening together.
A lot of people seem to want to use cookies for storing user language preference, however I don’t believe this is the best practice for search engine crawlers. Will eventually get to supporting this method too (as well as subdomain).

Ben

Profile