Welcome Guest, Not a member yet? Register   Sign In
How to create multiple languages website with CI?
#1

[eluser]Unknown[/eluser]
Hi everybody

I'm going to find solution to make my website work with multiple languages. Does anybody know the solution or other library to make it?
#2

[eluser]pistolPete[/eluser]
Use the forum search!

http://ellislab.com/forums/viewreply/547809/
http://codeigniter.com/wiki/URI_Language_Identifier
#3

[eluser]Vicente Russo[/eluser]
Try this.
#4

[eluser]squarebones[/eluser]
I've seen a lot of questions regarding internationalization of sites, but none of them satisfied me (okay, I couldn't understand them or get them to work). I came up with a solution that is simple, but depends upon sessions to work properly. I have a link on each page of my site (front-end, at least) that triggers either English or Spanish. There is a method in each controller that modifies the session data to whatever language link was clicked. The page then reloads with the proper language automagically (okay, with a little help from my friends).

Now, then. Each view that has two languages is built in such a way that it checks for the language before outputting the text using a ternary operator. This probably slows down the page creation process by some degree, but it was the most convenient way to get the job done in a hurry. My other option was to create a switch on each view that would load the page depending, again, on the language saved in the session variable.

Pros: session is persistent across pages.
Cons: hard to read view code in many cases.

If anyone would like some sample code, just respond here and I'll come up with some stripped down versions of what I am using.
#5

[eluser]Unknown[/eluser]
Yes, it's pretty good. I'm waiting to get your share. Bcoz now I have a lot of view files. So I need some tips of your code to improve it.




Theme © iAndrew 2016 - Forum software by © MyBB