summaryrefslogtreecommitdiff
path: root/lib/JWebmail/Plugin/I18N2.pm
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de>2022-05-01 22:02:37 +0200
committerJannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de>2022-05-01 22:02:37 +0200
commit7c8bd21ccbca8a3166289ab0e5511cc82d2822aa (patch)
tree89c77a638ee2c12f3b3a023562ee222d5a8d6324 /lib/JWebmail/Plugin/I18N2.pm
parentc94966aac2f16ca7a6f8c4c8988677515b46a45b (diff)
collection of smaller changes
Diffstat (limited to 'lib/JWebmail/Plugin/I18N2.pm')
-rw-r--r--lib/JWebmail/Plugin/I18N2.pm15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/JWebmail/Plugin/I18N2.pm b/lib/JWebmail/Plugin/I18N2.pm
index c951eec..61f87d6 100644
--- a/lib/JWebmail/Plugin/I18N2.pm
+++ b/lib/JWebmail/Plugin/I18N2.pm
@@ -125,8 +125,10 @@ sub register {
}
}
- $app->defaults(default_language => $defaultLang);
- $app->defaults(languages => [$t->languages]);
+ $app->defaults(
+ default_language => $defaultLang,
+ languages => [$t->languages],
+ );
# add translator as helper
$app->helper(l => sub {
@@ -142,16 +144,13 @@ sub register {
return $res;
});
- # modify incoming url
- $app->hook(before_dispatch => sub {
+ # modify incoming and generated urls
+ $app->hook(before_routes => sub {
my $c = shift;
+
unshift @{ $c->req->url->path->parts }, ''
unless $t->languages($c->req->url->path->parts->[0] || '');
- });
- # modify generated url
- $app->hook(before_dispatch => sub {
- my $c = shift;
$c->match(JWebmail::Plugin::I18N2::Match->new(
root => $c->app->routes,
_i18n2_stash => $c->stash,