line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zonemaster::Backend::Translator; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '1.1.0'; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
21
|
use 5.14.2; |
|
2
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
42
|
use Moose; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
20
|
|
8
|
2
|
|
|
2
|
|
13186
|
use Locale::TextDomain 'Zonemaster-Engine'; |
|
2
|
|
|
|
|
11232
|
|
|
2
|
|
|
|
|
11
|
|
9
|
2
|
|
|
2
|
|
852
|
use Encode; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
188
|
|
10
|
2
|
|
|
2
|
|
13
|
use POSIX qw[setlocale LC_ALL]; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Zonemaster Modules |
13
|
|
|
|
|
|
|
require Zonemaster::Engine::Translator; |
14
|
|
|
|
|
|
|
require Zonemaster::Engine::Logger::Entry; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'Zonemaster::Engine::Translator'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub translate_tag { |
19
|
290
|
|
|
290
|
1
|
506
|
my ( $self, $entry, $browser_lang ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
290
|
|
|
|
|
739
|
my $previous_locale = setlocale( LC_ALL ); |
22
|
290
|
50
|
|
|
|
647
|
if ( $browser_lang eq 'fr' ) { |
|
|
0
|
|
|
|
|
|
23
|
290
|
|
|
|
|
1372
|
setlocale( LC_ALL, "fr_FR.UTF-8" ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
elsif ( $browser_lang eq 'sv' ) { |
26
|
0
|
|
|
|
|
0
|
setlocale( LC_ALL, "sv_SE.UTF-8" ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else { |
29
|
0
|
|
|
|
|
0
|
setlocale( LC_ALL, "en_US.UTF-8" ); |
30
|
|
|
|
|
|
|
} |
31
|
290
|
|
|
|
|
8313
|
my $string = $self->data->{ $entry->{module} }{ $entry->{tag} }; |
32
|
|
|
|
|
|
|
|
33
|
290
|
50
|
|
|
|
2866
|
if ( not $string ) { |
34
|
0
|
|
|
|
|
0
|
return $entry->{string}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
290
|
|
|
|
|
593
|
my $blessed_entry = bless($entry, 'Zonemaster::Engine::Logger::Entry'); |
38
|
290
|
50
|
|
|
|
376
|
my $str = decode_utf8( __x( $string, %{ ($blessed_entry->can('printable_args'))?($blessed_entry->printable_args()):($entry->{args}) } ) ); |
|
290
|
|
|
|
|
1089
|
|
39
|
290
|
|
|
|
|
68685
|
setlocale( LC_ALL, $previous_locale ); |
40
|
|
|
|
|
|
|
|
41
|
290
|
|
|
|
|
1204
|
return $str; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |