Branch Coverage

lib/Mojolicious/Plugin/I18N.pm
Criterion Covered Total %
branch 38 52 73.0


line true false branch
40 0 42 $$conf{'no_header_detect'} ? :
50 0 42 if ($$conf{'support_hosts'} and my $host = $self->req->headers->host)
52 0 0 if (my $lang = $$conf{'support_hosts'}{$host})
60 12 30 if $languages[0]
63 42 0 if (my $path = $self->req->url->path)
66 12 23 if ($part and $langs and grep {$part eq $_;} @$langs)
68 0 12 if $self->res->code
92 0 96 unless $self->stash('i18n')
101 0 48 unless $self->stash('i18n')
114 31 51 if $url->is_abs
117 40 11 if @_ % 2 and not ref $_[0] or @_ > 1 and ref $_[-1]
120 2 49 @_ == 1 ? :
123 16 35 if (my $lang = $params{'lang'} || $self->stash('lang'))
127 6 10 if (not $$path[0]) { }
10 0 elsif (ref $langs ne 'ARRAY' or not scalar grep({$path->contains("/$_");} @$langs)) { }
157 38 58 unless (@languages)
172 58 0 if (my $handle = $namespace->get_handle(@languages))
184 0 48 unless my $handle = $$self{'handle'}
192 0 98 unless $namespace and $lang
197 3 95 unless ($namespace->can('new'))
203 2 1 if ($@)
207 0 2 if $@
213 15 181 unless ($module->can('new'))
220 14 1 if ($@ or not eval "%${module}::Lexicon")
221 1 13 if ($_ eq $default)
225 0 1 if $@