This file is indexed.

/usr/share/perl5/EBox/Gettext.pm is in zentyal-common 2.3.3.

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
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# Copyright (C) 2008-2012 eBox Technologies S.L.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

package EBox::Gettext;

use Locale::gettext;
use EBox::Config;

BEGIN {
    use Exporter ();
    our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);

    @ISA = qw(Exporter);
    @EXPORT = qw{ __ __n __x __d __dx __s __sx __p __px settextdomain gettextdomain langs };
    %EXPORT_TAGS = ( DEFAULT => \@EXPORT );
    @EXPORT_OK = qw();
    $VERSION = EBox::Config::version;
}

my $cur_domain = 'zentyal';
my $old_domain;

use constant SUBS_DOMAIN => 'zentyal-subscription';
use constant PROF_DOMAIN => 'zentyal-prof';

# Method: settextdomain
#
#   Sets the curent message domain
#
# Parameters:
#
#       domain - The domain name
#
sub settextdomain # (domain)
{
    my $domain = shift;
    textdomain($domain);
    bindtextdomain($domain, EBox::Config::locale());
    my $old_domain = $cur_domain;
    $cur_domain = $domain;
    return $old_domain;
}

# Method: gettextdomain
#
#   Gathers  the curent message domain
#
# Returns:
#
#      The current message domain
#
sub gettextdomain
{
    return $cur_domain;
}

sub __ # (text)
{
    my ($msgid) = @_;

    # FIXME: Probably there is a better way to do this
    # and avoid setting the domain every time, so this is a
    # temporary solution
    my $string = __d($msgid, 'zentyal');
    $string =~ s/\'/\&#39\;/g;
    $string =~ s/\"/\&#34\;/g;
    return $string;
}

sub __n # (text)
{
    my $string = shift;
    my ($p, $a, $c) = caller;
    return $string;
}

sub __x # (text, %variables)
{
    my ($msgid, %vars) = @_;
    #FIXME: my $string = gettext($msgid);
    my $string = __d($msgid, 'zentyal');
    return __expand($string, %vars);
}

sub __d # (text,domain)
{
    my ($string, $domain) = @_;

    return '' unless ($string);

    bindtextdomain($domain, EBox::Config::locale());
    textdomain($domain);
    $string = gettext($string);
    textdomain($cur_domain);
    return $string;
}

sub __dx # (text,domain, %variables)
{
    my ($string, $domain, %vars) = @_;

    return '' unless ($string);

    bindtextdomain($domain, EBox::Config::locale());
    textdomain($domain);
    $string = gettext($string);
    textdomain($cur_domain);
    return __expand($string, %vars);
}

sub __s # (text)
{
    my ($text) = @_;
    return __d($text, SUBS_DOMAIN);

}

sub __sx # (text, %variables)
{
    my ($text, %vars) = @_;

    return __dx($text, SUBS_DOMAIN, %vars);
}

sub __p # (text)
{
    my ($text) = @_;
    return __d($text, PROF_DOMAIN);

}

sub __px # (text, %variables)
{
    my ($text, %vars) = @_;

    return __dx($text, PROF_DOMAIN, %vars);
}

sub __expand # (translation, %arguments)
{
    my ($translation, %args) = @_;

    my $re = join '|', map { quotemeta $_ } keys %args;
    $translation =~ s/\{($re)\}/defined $args{$1} ? $args{$1} : "{$1}"/ge;
    return $translation;
}

my $langs = undef;

# Method:  langname
#
#       Gathers the current set language
#
# Returns:
#
#   the current domain language
#
sub langname # (locale)
{
    my ($locale) = @_;

    return langs()->{$locale};
}

# Method: langs
#
#   gathers the available languages
#
# Returns:
#
#   hash reference -  containing the available languages. Each key
#   represents a *locale* and its value contains the associated
#   language
#
sub langs
{
    unless (defined $langs) {
        $langs = {};
        $langs->{'an_ES.UTF-8'} = 'Aragonés';
        $langs->{'bn_BD.UTF-8'} = 'Bengali';
        $langs->{'bg_BG.UTF-8'} = 'Български';
        $langs->{'es_ES.UTF-8'} = 'Español';
        $langs->{'et_EE.UTF-8'} = 'Eesti';
        $langs->{'ca_ES.UTF-8'} = 'Català';
        $langs->{'cs_CZ.UTF-8'} = 'Czech';
        $langs->{'da_DK.UTF-8'} = 'Dansk';
        $langs->{'de_DE.UTF-8'} = 'Deutsch';
        $langs->{'el_GR.UTF-8'} = 'ελληνικά';
        if (EBox::Config::configkey('english_locale')) {
            $langs->{'en_US.UTF-8'} = 'English';
        } else {
            $langs->{'C'} = 'English';
        }
        $langs->{'eu_ES.UTF-8'} = 'Euskara';
        $langs->{'fa_IR.UTF-8'} = 'فارسی';
        $langs->{'fr_FR.UTF-8'} = 'Français';
        $langs->{'gl_ES.UTF-8'} = 'Galego';
        $langs->{'hu_HU.UTF-8'} = 'Magyar';
        $langs->{'it_IT.UTF-8'} = 'Italiano';
        $langs->{'ja_JP.UTF-8'} = '日本語';
        $langs->{'lt_LT.UTF-8'} = 'Lietuvių';
        $langs->{'nb_NO.UTF-8'} = 'Norsk (bokmål)';
        $langs->{'nl_BE.UTF-8'} = 'Nederlands';
        $langs->{'pl_PL.UTF-8'} = 'Polski';
        $langs->{'pt_BR.UTF-8'} = 'Português do Brasil';
        $langs->{'pt_PT.UTF-8'} = 'Português';
        $langs->{'ro_RO.UTF-8'} = 'Română';
        $langs->{'ru_RU.UTF-8'} = 'Русский';
        $langs->{'sv_SE.UTF-8'} = 'Svenska';
        $langs->{'th_TH.UTF-8'} = 'ภาษาไทย';
        $langs->{'tr_TR.UTF-8'} = 'Türkçe';
        $langs->{'uk_UA.UTF-8'} = 'украї́нська';
        $langs->{'zh_CN.UTF-8'} = '汉字';
        $langs->{'zh_TW.UTF-8'} = '繁體中文';
    }

    return $langs;
}

1;