line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## @file |
2
|
|
|
|
|
|
|
# Messages translation for Lemonldap::NG::Manager |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
## @class |
5
|
|
|
|
|
|
|
# Messages translation for Lemonldap::NG::Manager. |
6
|
|
|
|
|
|
|
package Lemonldap::NG::Manager::_i18n; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Developer warning : this file must be utf8 encoded |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
915
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
11
|
1
|
|
|
1
|
|
707
|
use AutoLoader qw(AUTOLOAD); |
|
1
|
|
|
|
|
1462
|
|
|
1
|
|
|
|
|
7
|
|
12
|
|
|
|
|
|
|
our $VERSION = '1.4.0'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
## @method string translate(string text,string lang) |
15
|
|
|
|
|
|
|
# Returns $text translated in $lang. |
16
|
|
|
|
|
|
|
#@param $text textId |
17
|
|
|
|
|
|
|
#@param $lang Optional language string. If not set, uses Accept-Language |
18
|
|
|
|
|
|
|
# HTTP header. |
19
|
|
|
|
|
|
|
sub translate { |
20
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $text, $lang ) = @_; |
21
|
0
|
0
|
|
|
|
0
|
return $text unless ( $text =~ /[a-z]/ ); |
22
|
0
|
|
0
|
|
|
0
|
$lang ||= $ENV{HTTP_ACCEPT_LANGUAGE}; |
23
|
0
|
|
|
|
|
0
|
$lang = lc($lang); |
24
|
0
|
|
|
|
|
0
|
$lang =~ s/-/_/g; |
25
|
0
|
|
|
|
|
0
|
foreach ( split( /[,;]/, $lang ), 'en' ) { |
26
|
0
|
0
|
|
|
|
0
|
next if /=/; |
27
|
0
|
0
|
|
|
|
0
|
if ( __PACKAGE__->can($_) ) { |
28
|
1
|
|
|
1
|
|
144
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
149
|
|
29
|
0
|
|
|
|
|
0
|
my $r = &$_()->{$text}; |
30
|
0
|
0
|
|
|
|
0
|
if ($r) { |
31
|
0
|
|
|
|
|
0
|
return $r; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
0
|
|
|
|
|
0
|
$self->lmLog( __PACKAGE__ . ": $text not translated in $_", |
35
|
|
|
|
|
|
|
'error' ); |
36
|
0
|
|
|
|
|
0
|
return $text; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
*fr_fr = *fr; |
43
|
|
|
|
|
|
|
*en_us = *en; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |