Welcome Guest, Not a member yet? Register   Sign In
Poll: URI language identifier in core?
You do not have permission to vote in this poll.
22 52.38%
11 26.19%
9 21.43%
Total 42 vote(s) 100%
* You voted for this item. [Show Results]

Add URI Language Identifier to core?

(This post was last modified: 04-12-2015, 11:29 AM by ciadmin.)

(I just start using CI for a few weeks and I like it. Hope it's not a stupid question/request.)

Although there are a solution on the Github wiki (https://github.com/bcit-ci/CodeIgniter/w...Identifier), I think it should be in the core for nicer localization and SEO.

How you guys think?

What exactly are you proposing? "URI language identifier in core" is too vague.
The article you reference seems to suggest changing the routing (which would not work for everyone) and enhancing the Lang class.

Are you suggesting that something like this be built in so that all CI sites should do this?

The purpose is to make URL like http://www.apple.com/ (English), http://www.apple.com/fr (French), http://www.apple.com/hk (Hong Kong). This is one of the best way for handling multilingual website I think.
I didn't mean to force everyone who making multilingual site to follow this. Using cookie or query string are good way too but I personally think that these are not elegant enough. It will be nice if CI provide us with this choice and make this as a build in solution.

I prefer the usual url layout example.com/class/function/ID (where class is the controller) and work with resource files.
So no need for a 'language segment'.

I am curious what others think. What are the advantages of this approach?

I read the Wiki material in the past, but I didn't like it. I've got another implementation for CI3.

http://iridadesign.com/starter-public-edition-4/www/ - The default language English. There is an option for hiding the language segment for the default language, you can use it especially if the site supports only one language.
http://iridadesign.com/starter-public-edition-4/www/en/ - English again.
http://iridadesign.com/starter-public-edition-4/www/bg/ - Bulgarian
http://iridadesign.com/starter-public-edition-4/www/fr/ - French
http://iridadesign.com/starter-public-edition-4/www/pl/ - Polish
etc ...

A key precondition: The language segment is transparent for the routing system. Once it has been read it disappears from the internal array(s) that contain URI segments. Don't patch the routes.php configuration file about language support.

1 SEO tip
/ - is english
/en must not exists - else you will have duplicate content (you can handle this case with canonicals but its not a good option..)

For the thread - yes there is a need of supporting locale inside the router by default.
There is always locale - 1 default or many it doesn't matter. Even if its not displayed (if its 1 only) you again have language which you will output.
So CI must provide fast and easy way to catch and handle language/locale by its routers..
Best VPS Hosting : Digital Ocean

(This post was last modified: 04-13-2015, 03:36 AM by ivantcholakov. Edit Reason: Thanks )


I generate the links according to your recommendation. "Hidden" routes are not good indeed, duplicates that I am causing could be blocked easily, I suppose.

Speaking of SEO...
http://iridadesign.com/starter-public-ed...itemap.xml - the root entry.
http://iridadesign.com/starter-public-ed...itemap/xml - an entry specific to a particular module, this one declares language translations.

Edit 13-APR-2015:
Thank you very much! I have just put 301 redirections for solving the duplicate content problem.

For SEO with duplicate content, don't redirect, use canonical URLs:

(This post was last modified: 04-13-2015, 02:45 PM by ivantcholakov.)

From what I've read, both of canonical URLs and 301 redirects are possible methods, I hesitate. Now I did redirection, code for this is within the router and it is dirty, because there is no controller instance created, I don't like it.

Maybe canonicalization would be better, and for making it easy, base controller (for example) should propose a default method for generation of canonical URL. TODO.

Edit: I got in favor for canonicalization, because it would deal with more duplicates:

I voted No, because I do not want the framework to dictate how I choose to handle multi-language implementations.

It depends so much on the site itself, that I have used several approaches in the past with CI, all of them easy enough to implement.

There is no clear or set answer as to how to handle multi language implementations. It depends on the needs of the client.


Theme © iAndrew 2016 - Forum software by © MyBB