I have a site; I need to develop to support multiple languages, for example en, tr, ar, sp, etc.
But the problem is , what is the best way to do it with Codeigniter?
I have a controller ( SITE ). I have a lot of functions LIKE ( hotel , city , page , blog )
I want to before this method add a segment ( language ). This is old links
http://example.com/hotel/mariot
http://example.com/hotel/hilton
http://example.com/city/london
http://example.com/city/paris
...
..
and I want the links to be like this
http://example.com/en/hotel/mariot
http://example.com/ar/hotel/mariot
http://example.com/sp/hotel/mariot
http://example.com/tr/hotel/mariot
http://example.com/en/city/london
http://example.com/ar/city/paris
....
..
sometimes thinking every language have a controller but it is possible...
What is the best way to change all links to support the languages?
I'm sorry If my question is not clear, this is my English.
if you want your links to be like this
http://example.com/en/something
then you might need to have subdomain or folder in your project called en. but yet this is not the perfect solution.
what you have to do is to make your text output assigned into variables which takes their values from an xml file. like if you have some text called "your room number is: 0" and this value is hard coded HTML then you should put it in en.xml file under some tag and get it from the xml file which is requested by the user according to the required lang.
you might can do the previous solution in all languages but you have to consider that Arabic language is RTL language so just consider that in your css. But generally you can use xml files to control the languages.
hope that is what you needed.
The right way, is using routes.php look for it inside (application/config/routes.php)
You can use regex expressions for your specific problem.
here is the manual: http://ellislab.com/codeigniter/user-guide/general/routing.html