On Thu, 30 Sep 2010 22:32:03 +0200 Ekki Plicht (DF4OR) wrote: > Am I right that this combination (see subject) does not work well > together?
Dunno, never tried them, but if they don't work together it's a bug that should be fixed. > AFAICS C::P::I18N::Request modifies the path very early in the request > cycle, before the dispatcher and C::P::I18N::PathPrefix can kick in, > right? Yup, but if you swap the order of these two plugins, ::PathPrefix can act before ::Request (and, BTW, ::PathPrefix also acts before the dispatcher, these two modules hook to the same method:-). Can you try if it works if you simply change the order of loading ::Request and ::PathPrefix? (If it works then I'll update the documentation to mention it.) > IOW: Regardless of what path prefix (language) I use, > C::P::I18N::Request only looks at the 'accept-language' header > parameter, right? That makes this combination unusable... too bad. Nope, ::Request uses $c->localize(), and that uses $c->languages(), and C:P:I18N::PathPrefix sets that to the language from the path prefix. So they should work together smoothly (given that ::PathPrefix has the first turn). > I would love to have localized path names (like I18N::Request offers), > but also the possibility to let the user change languages at will (like > I18N::PathPrefix + session mgmt offers). That includes letting her > select a different language than what her browsers header > 'accept-language' is set to. You can achieve that using C:P:I18N, C:P:I18N::PathPrefix and C:P:I18N::Request together. Also you don't need a session for that: if the user uses an URL to your site with a language code path prefix, that language will be used throughout the site until (s)he switches language, if (s)he uses an URL without a language code path prefix then it will be set from the 'accept-language'. Alternatively you can set a plain cookie if you want to remember the preferred language from the previous "browsing session" and if (s)he uses an URL without a path prefix you can use the value of this cookie to override the language detected from 'accept-language'. norbi _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
