[Catalyst] Language selection in URLs
orasnita at gmail.com
Sun Nov 15 16:15:08 GMT 2009
From: "Joel Bernstein" <joel at fysh.org>
On 15 Nov 2009, at 15:06, Bill Moseley wrote:
> What's your preferred approach to specifying a language tag in a URL? Is
> there strong argument for one over the other?
> http://example.com/en_us/path/to/some/index.html # language prefix
No no no! Allow the client and server to negotiate what content to serve for
the resource identified. As a URI to a resource which may vary according to
many dimensions, /path/to/some/content is fine.
GET /path/to/content HTTP/1.1
A better question is: what kind of problems are you solving where
server-driven or agent-driven content negotiation as described in the HTTP
1.1 RFC (an excellent and very readable document, honestly) are
The most important reason I needed to use URLS like /en/dir/file,
/ro/dir/file was the fact that very many users, although they don't know
English, they use the browser with the default configurations so they see
the pages in English and then they don't like it and want to change it.
So I use the following rules (in order) for choosing the current language:
1. The language chosen by the user by clicking the wanted flag;
2. The language which is specified in the URL like /ro/dir/file;
3. The language prefered by the browser;
4. The default language (if the site doesn't offer translation for the
browser-prefered language, or if there is no browser-prefered language).
Using different URLS for different pages might help search engines to index
the site, because otherwise the search engines might not try to access the
site with all possible languages in order to see if the web site offers
content in those languages.
(There may be other solutions for this, like specifying the alternate
versions of the page as meta tags or something like that, but I don't know
how to do that or if it is possible.)
More information about the Catalyst