views:

93

answers:

2

I'm starting a new site project in Codeigniter. I need this site to be multilingual, where English will be the default language. I know how the language class in codeigniter works, and I am already using it.

My concern is that I need the URL to be shown in the selected language. I'll explain myself with an example:

When English language is selected, I have this URL: www.domain.com/cars/list_cars where cars is the controller and list_cars is the method in charge of calling the appropriate view.

When Spanish language language is selected, I would like the URL to show as www.domain.com/coches/mostrar_coches

Which is the best way to achieve this? The only way I can think of is by changing routes.php with something like:

$route['cars/list_cars'] = 'coches/mostrar_coches';

Is there any better/easier way of achieving this?

Thanks!

A: 

Translating your controller and method names is a headache waiting to happen. The benefits to your SEO are so minimal that it is really not worth doing, just make sure you have good content.

Phil Sturgeon
I'm surprised of your answer. I'm not a SEO guru, but I've read many times that having keyword in your URL is one of the most important points to consider.That is why I want to "translate" the URL.
yinyang78
SEO benefits would be substantial in the right circumstances. Thought needs to be put in to it.
stef
Hey if you want to manually translate every single URL so you can have a slight SEO bump go ahead, I'd rather just make sure my content is good for each language.
Phil Sturgeon
A: 

I did what you propose, using routes.php for your localised url segments. Works fine for me but for every page you do need a new entry in your routes file.

stef
having an entry in routes.php for each page is what puts me off, but I suppose it is the only way around to do it.Codeigniter needs to know what you want to translate the name page to, and in this situation I cant use a regexp.
yinyang78