This file is indexed.

/usr/share/perl5/Petal/TranslationService/Gettext.pm is in libpetal-perl 2.23-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package Petal::TranslationService::Gettext;
use Petal::TranslationService::MOFile;
use warnings;
use strict;

sub new
{
    my $class = shift;
    return bless {
        # defaults...
        locale_dir  => '/usr/share/locale',
        target_lang => 'en',

        # optional overriding args
        @_,
    }, $class;
}


sub maketext
{
    my $self = shift;
    my $tsrv = $self->mo_file_translation_service();
    ref $tsrv and return $tsrv->maketext (@_);
    return;
}


sub target_lang
{
    my $self = shift;
    $self->{target_lang} =~ s/-/_/;
    return $self->{target_lang};
}


sub mo_file_translation_service
{
    my $self   = shift;
    my $domain = $Petal::I18N::Domain || 'default';
    $self->{mo_file_tranlation_services} ||= {};
    $self->{mo_file_tranlation_services}->{$domain} ||= $self->_mo_file_translation_service();
    return $self->{mo_file_tranlation_services}->{$domain};
}


sub _mo_file_translation_service
{
    my $self   = shift;
    my $target_lang = $self->target_lang() || die 'target_lang() returned undef';
    my $domain = $Petal::I18N::Domain || 'default';
    my $res    = undef;

    $res = $self->_instanciate_mo_file_tranlation_service_if_file_exists ($target_lang);
    $res && return $res;

    $target_lang =~ s/_.*$//;

    $res = $self->_instanciate_mo_file_tranlation_service_if_file_exists ($target_lang);
    $res && return $res;

    return '__none__';
}


sub _instanciate_mo_file_tranlation_service_if_file_exists
{
    my $self        = shift;
    my $target_lang = $self->{target_lang};
    my $domain      = $Petal::I18N::Domain || 'default';

    my $locale_dir = $self->{locale_dir};
    $locale_dir    =~ s/\/$//;
   
    my $mo_file_relative_path = "/$target_lang/LC_MESSAGES/$domain.mo";
    my $mo_file_absolute_path = $locale_dir . $mo_file_relative_path;

   -e $mo_file_absolute_path or return;
   return Petal::TranslationService::MOFile->new ($mo_file_absolute_path);
}


1;


__END__