From 9c89488558f12ef635dd7b43dbcb9a4e0f793f3c Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 22 Jul 2015 15:00:55 +0200 Subject: [PATCH] Correctly fallback to en when requesting an unsupported lang --- vroom.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vroom.pl b/vroom.pl index cf823b6..f31b9a6 100755 --- a/vroom.pl +++ b/vroom.pl @@ -1573,10 +1573,12 @@ any [qw(GET POST)] => '/invitation/:token' => { token => '' } => sub { }; # Create a json script which contains localization -get '/locales/(:lang).js' => { lang => 'en' } => sub { +get '/locales/(:lang).js' => sub { my $self = shift; my $usr_lang = $self->languages; my $req_lang = $self->stash('lang'); + $req_lang = (grep { $_ eq $req_lang } $self->get_supported_lang) ? + $req_lang : 'en'; # Temporarily switch to the requested locale # eg, we can be in en and ask for /locales/fr.js $self->languages($req_lang);