This file is indexed.

/usr/share/perl5/Curses/UI/Language.pm is in libcurses-ui-perl 0.9609-1.

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
# ----------------------------------------------------------------------
# Curses::UI::Language
#
# (c) 2001-2002 by Maurice Makaay. All rights reserved.
# This file is part of Curses::UI. Curses::UI is free software.
# You can redistribute it and/or modify it under the same terms
# as perl itself.
#
# Currently maintained by Marcus Thiesen
# e-mail: marcus@cpan.thiesenweb.de
# ----------------------------------------------------------------------

package Curses::UI::Language;

my $default_lang = 'English';

my %lang_alias = (
    'en'        => 'english',
    'uk'        => 'english',
    'us'        => 'english',

    'it'        => 'italian',

    'pl'        => 'polish',

    'ru'        => 'russian',

    'de'        => 'german',
    'at'        => 'german',
    'ch'        => 'german',

    'du'        => 'dutch',
    'nl'        => 'dutch',

    'fr'        => 'french',

    'pt'        => 'portuguese',
    'pt_BR'     => 'portuguese',
    'br'        => 'portuguese',

    'no'        => 'norwegian',

    'es'        => 'spanish',

    'tr'        => 'tukish',

    'cn'        => 'chinese',

);

sub new()
{
    my $class = shift;
    my $lang  = shift; 

    my $this = {
	-tags => {},
	-lang => undef,
    };
    bless $this, $class;

    # Load english tags so these can be used
    # as a fallback for other languages.
    $this->loadlanguage('english');

    # Load the wanted language.
    $this->loadlanguage($lang);

    return $this;
}

sub loadlanguage($;)
{
    my $this = shift;
    my $lang = shift;

    # Construct the language module to use.
    $lang = $default_lang unless defined $lang;
    $lang =~ s/[^\w\_]//g;
    $lang = lc $lang;
    $lang = $lang_alias{$lang} if defined $lang_alias{$lang};

    # Loading the same language twice is not very useful.
    return $this if defined $this->{-lang} and 
                    $lang eq $this->{-lang};

    # Determine filename for the language package.
    (my $l_file = __FILE__) =~ s/\.pm$/\/$lang\.pm/;

    # Save the name of the currently loaded language.
    $this->{-lang} = $lang;

    # Create a filehandle to the __DATA__ section 
    # of the language package.
    local *LANG_DATA;
    open(LANG_DATA, "< $l_file") or die "Can't open $l_file: $!";
    
    while (<LANG_DATA>) {
	last if /^\s*__DATA__$/;
    }

    # Read and store tags/blocks.
    my $tag   = undef;
    my $block = '';
    LINE: while (<LANG_DATA>) {
	if (m/^#/) {
	    next LINE;
	}
	elsif (m/^\s*\[\s*(.*)\s*\]\s*(.*)$/) {
	    my $oldtag = $tag;
	    $tag = $1;
	    $this->store($oldtag, $block);
	    $block = $2; 
	    $block = '' unless defined $block;
	}
	elsif (defined $tag) {
	    $block .= "$_";
	}
	elsif (!m/^\s*$/) {
	    warn "$l_file, line $.: found data outside tag block\n";
	}
    }
    $this->store($tag, $block);

    close(LANG_DATA);
}

sub store($$;)
{
    my $this  = shift;
    my $tag   = shift;
    my $block = shift;

    return $this unless defined $tag;

    # Remove empty start- and endlines.
    my @block = split /\n/, $block;
    while (@block and $block[0]  =~ /^\s*$/) { shift @block }
    while (@block and $block[-1] =~ /^\s*$/) { pop @block   }

    $this->{-tags}->{lc $tag} = join "\n", @block;

    return $this;
}


sub get($;)
{
    my $this  = shift;
    my $tag   = shift;

    my $block = $this->{-tags}->{$tag};
    unless (defined $block) {
        warn "get(): no language block for tag '$tag'";
	$block = '';
    }

    return $block;
}

sub getarray($;)
{
    my $this = shift;
    my $tag  = shift;

    my $block = $this->get($tag); 
    return () unless defined $block;

    $block =~ s/\n/ /g;
    return split " ", $block;
}


1;