Welcome Guest, Not a member yet? Register   Sign In
Multi language application
#1

[eluser]Stoppy[/eluser]
Hi!
I have to develop a multi language application. What is the best way to do it in codeigniter?

Consider I am going to use datamapper and that I would like just to do it changing language files according by the url the user is visiting.

example:

www.mysite.ext/mycontroller/
www.mysite.ext/mycontroller/mymethod/url_rewriter.html

www.mysite.ext/es/mycontroller/
www.mysite.ext/es/mycontroller/mymethod/url_rewriter.html

www.mysite.ext/fr/mycontroller/
www.mysite.ext/fr/mycontroller/mymethod/url_rewriter.html

and so on....

Thank You!
#2

[eluser]smilie[/eluser]
Hi,

I am doing it through CI session; I store user defined language in session and than use that to get appropriate text.

Cheers,
Smilie
#3

[eluser]Stoppy[/eluser]
Hi,
ok it could be an idea but I would like that search engines will be able to find all url of all languages.
So i would like to have a "static" structure.
Thanks
[quote author="smilie" date="1294774886"]Hi,

I am doing it through CI session; I store user defined language in session and than use that to get appropriate text.

Cheers,
Smilie[/quote]
#4

[eluser]peredurabefrog[/eluser]
[quote author="smilie" date="1294774886"]Hi,

I am doing it through CI session; I store user defined language in session and than use that to get appropriate text.

Cheers,
Smilie[/quote]

Interesting. How do you deal with the situation where the user wants to change language within a single session? Presumably they must do that by clicking on a link accessible from all pages that passes the language in via the query string. So do you check the $_GET array (or a variable passed into the controller function) in every controller function and compare it with the session language, changing the session language variable if they're different? Or do you have a better way?

This is very interesting to me because I'm porting an existing bilingual site to CI (http://www.wales-legislation.org.uk/index.php - the version you see at this URL is a bit of a mongrel because I've had to do some mending of the existing site as a first priority. In fact there are still some more changes to the existing site to put live before I really get started on the CI project. So don't be too critical :red: ). It is very important to our users that they can easily change between the two languages.


Cheers


Peredur
#5

[eluser]Cristian Gilè[/eluser]
Here

Cristian Gilè
#6

[eluser]peredurabefrog[/eluser]
[quote author="Cristian Gilè" date="1294805187"]Here

Cristian Gilè[/quote]

Hi Cristian,

That's very interesting. Thanks. I have one question if you don't mind.

These libraries seem oriented towards single line translations, for things like error messages. For my project I need to have translations of whole pages. For example:

http://www.wales-legislation.org.uk/intro.php?lang=en

Is the use of a library such as the one you refer to the best solution for such a situation? For instance, would I need to provide a separate language string for every list item in every list? Or can the language strings include HTML, and would including HTML in language strings be a safe thing to do? Or have I misunderstood something.

Apologies if these questions are naive. I couldn't find any discussion of such matters anywhere else.

Cheers


Peredur




Theme © iAndrew 2016 - Forum software by © MyBB