[Catalyst] Multilanguage application
brian.cassidy at nald.ca
Thu Aug 10 16:45:56 CEST 2006
Renaud Drousies wrote:
> I am trying to figure out what would be the best way to have a
> multilanguage support in a catalyst application.
> I thought using a url-based method might be better since this site could
> be visited by people that do not accept cookies, or do not visit it from
> their home computer (and then could not have the Accept-Language header
> set correctly).
[* SNIP *]
> I was then wondering if that was the good way (and the one with less
> effort) to handle multilanguage sites with catalyst, without relying on
> cookies and accept-language headers. Any thoughts? :)
As you've noted, the Accept-Language header for a particular user agent
may not be set properly, however, there is a decent workaround that we
use for our apps:
NB: We're using apache 2 for this trick
1) Use the I18N plugin. This will give you the framework for a
multi-lingual app. It relies on the Accept-Language header, so, via the
test server you'll have to change your browser settings to test each
2) Enable mod_headers
LoadModule headers_module modules/mod_headers.so
3) For a particular site, bind a url to a language by setting the
Accept-Language header explicitly.
Example, we have a news aggregator we call the "newswire". the urls are
set up as follows:
RequestHeader set Accept-Language en
RequestHeader set Accept-Language fr
You could, if you wanted, bind the languages to /en/ and /fr/ off of one
particular url just as easily.
More information about the Catalyst