[dancer-users] Set interface language via URL path

Pedro Melo melo at simplicidade.org
Mon Jul 8 13:34:38 BST 2013


Hi,

On Fri, Jul 5, 2013 at 5:54 PM, Henk van Oers <hvo.pm at xs4all.nl> wrote:

> On Fri, 5 Jul 2013, Pedro Melo wrote:
>
>  I'm being asked to write a webapp for a site that will have three
>> versions for, one for each language.
>>
>> The current idea is to use http://site.tld/en/, http://**site.tld/de/<http://site.tld/de/>and
>> http://site.tld/fr/.
>>
>> I'll need to think this over on how to do this with Dancer2, but I want
>> to reuse as much as possible of the routes between the three sites.
>>
>> Does anybody did this before and can share a strategy? My current best
>> solution for this would be to had a hook as soon as possible and remove the
>> first level path if it matches one of the languages we
>> support and set a var for it.
>>
>> Any other suggestions?
>>
>
> For static pages I use http://site.tld/name/of/**document/<http://site.tld/name/of/document/>
> and than 'index' . $lang . 'html'
>
> For dynamic pages I use request->request_language()
>
> For loged-in users I use the language in there profile.
>
> There is no need for $lang in the route IMHO.
>

/LANG/ prefix should not be needed if you can trust language negotiation,
sure. But I'm tired of fighting proxys that cache pages ignoring those
headers to go this route.


How big will get ':lang' => sub { ... } be?


I don't understand this. I don't have a route like that.

Bye,
-- 
Pedro Melo
@pedromelo
http://www.simplicidade.org/
xmpp:melo at simplicidade.org
mailto:melo at simplicidade.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20130708/036694b6/attachment.htm>


More information about the dancer-users mailing list