Re: dhandlers and Language
"Jonathan Swartz" <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
> I've just written a perl module to do component level language negotiation. > > At present it expects to be used from within a dhandler - a request for '/index.html' will look at the Accept-Language header from the client, and try to grab the best match for the client's request (perhaps /index.html.es or /index.html.en-us). It allows you to override your browser's Accept-Language by starting your URI path with a language code. i.e.: > http://www.foo.com/es/index.html > will look for /index.html.es first, regardless of your Accept-Language preferences. > > The idea is that every component can have language specific versions, and mason will grab the best match, on a component by component basis. > > This works on the top level right now, but needs to happen for every component. > > a) Can I get dhandler functionality for all component requests, not just the top level? No, not currently, unless you use a subrequest for every component call, but that's definitely wrong. > > If not, > > b) would it be better to do this in the Resolver, and if so, what should I override? Yes, it would be much better to create a subclass of HTML::Mason::Resolver::File. Override the get_info subroutine to first look for "$path.language", and fall back to the default parent behavior if that component can't be found. Jon ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click