Multilingual website with internalization i18n - Index page |
[eluser]Unknown[/eluser]
Hello, I'm a new user with codeigniter... First, please forgive for my poor english ![]() 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.
[eluser]OliverHR[/eluser]
Use sessions storage user prefs cookies or server.
[eluser]benjamincurrie[/eluser]
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/CodeIg...age-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 |
Welcome Guest, Not a member yet? Register Sign In |