[Catalyst] Language selection in URLs

Stephan Jauernick stephan at stejau.de
Sun Nov 15 16:31:28 GMT 2009


Hi,

I would suggest you:
http://search.cpan.org/~stephanj/Catalyst-TraitFor-Request-PerLanguageDomains-0.01/lib/Catalyst/TraitFor/Request/PerLanguageDomains.pm



Octavian Râsnita schrieb:
> 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
>>
>> http://example.com/path/to/some/index.html?lang=en_us
> 
> 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
> Accept-Language: en
> Accept: text/html
> 
> 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
> insufficient?
> 
> /joel
> 
> 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.)
> 
> Octavian
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list