Welcome Guest, Not a member yet? Register   Sign In
Leanest way of going multilingual
#1

[eluser]fauria81[/eluser]
Hi everybody!

Ive just started a new project using Codeigniter (i have done a couple more before), but this time i need to go multilingal (10 languages, including latin, cyrilic, arabic, chinese and japanese).

I would like to optimize the website for SEO, and regarding URL's, ive think on something like:

http://en.example.com/search/products/keyword: Search for products containing 'keyword' in English.
http://es.example.com/busqueda/productos/palabra: Search ('busqueda') for products ('productos') containing keyword ('palabra') in Spanish.

Basically i need both controllers class names and methods in several languages.

I think i can use
Code:
_remap()
on my controllers, and tweak
Code:
routes.php
to handle the first segment of the URL and force a language.

If http://www.example.com/whatever is used, i think i will determine the language via IP, and then redirect to http://xx.example.com, or fallback to English by default, but maybe another approach would be more desirable.

Any suggestions would be appreciated. Thank you very much!
#2

[eluser]n0xie[/eluser]
I found this to be the easiest to use when dealing with multiple languages: http://maestric.com/doc/php/codeigniter_i18n
#3

[eluser]fedeisas[/eluser]
[quote author="n0xie" date="1286548314"]I found this to be the easiest to use when dealing with multiple languages: http://maestric.com/doc/php/codeigniter_i18n[/quote]

I've also used this library and it rocks! Altough, you'll have to write some routes for your controllers. I mean:

$route['(:any)/busqueda/productos/(.+)$'] = "search/products/$1";
$route['(:any)/search/products/(.+)$'] = "search/products/$1";

To avoid doing this, some folks use some urls like this:
www.example.com/buscar/productos/computadores/sp-1
www.example.com/search/products/computers/sp-1

And the real WORKING part of the url, is the last segment. So, their controller get the last segment and SP-1 stands for Search Product with ID = 1.
This unorthodox method works right when you need multilingual URLs.

Although I'm not really sure how this pretty URLs impact on SEO rankings.

Good Luck




Theme © iAndrew 2016 - Forum software by © MyBB