[Catalyst] Language selection in URLs
Octavian Râsnita
orasnita at gmail.com
Sun Nov 15 16:00:58 GMT 2009
From: "Bill Moseley" <moseley at hank.org>
> 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
I prefer the former way because the URL looks nicer.
(Not a very "strong" argument:)
> Are pages in different languages different resources or different versions
> of the same resource?
In most cases I think it is the same content with a different presentation
style, language...
> Obviously, the prefix is easier if you use relative URLs, but uri_for
> makes
> adding the query parameter easy. Although, probably could argue that the
> prefix approach is more efficient than wrapping uri_for for every
> generated
> link.
There is an example on the Catalyst wiki for overriding prepare_path() in
order to use urls like /en/path/to/another/file.html without needing to
change all controllers.
Octavian
More information about the Catalyst
mailing list