This file is indexed.

/usr/share/perl5/Locale/Msgfmt/po.pm is in liblocale-msgfmt-perl 0.14-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
package Locale::Msgfmt::po;

use Locale::Msgfmt::Utils;

use strict;
use warnings;

our $VERSION = '0.14';

sub new {
	my $class = shift;
	return bless shift || {}, $class;
}

sub cleanup_string {
	my $str = shift;
	$str =~ s/\\n/\n/g;
	$str =~ s/\\r/\r/g;
	$str =~ s/\\t/\t/g;
	$str =~ s/\\"/"/g;
	$str =~ s/\\\\/\\/g;
	return $str;
}

sub add_string {
	my $self = shift;
	my $hash = shift;
	my %h    = %{$hash};
	return if !( defined( $h{msgid} ) && defined( $h{msgstr} ) );
	return if ( $h{fuzzy} && !$self->{fuzzy} && length( $h{msgid} ) > 0 );
	my $msgstr = join Locale::Msgfmt::Utils::null(), @{ $h{msgstr} };
	return if ( $msgstr eq "" );
	my $context;
	my $plural;

	if ( $h{msgctxt} ) {
		$context = cleanup_string( $h{msgctxt} ) . Locale::Msgfmt::Utils::eot();
	} else {
		$context = "";
	}
	if ( $h{msgid_plural} ) {
		$plural = Locale::Msgfmt::Utils::null() . cleanup_string( $h{msgid_plural} );
	} else {
		$plural = "";
	}
	$self->{mo}->add_string( $context . cleanup_string( $h{msgid} ) . $plural, cleanup_string($msgstr) );
}

sub read_po {
	my $self   = shift;
	my $pofile = shift;
	my $mo     = $self->{mo};
	open my $F, '<', $pofile or die "Could not open ($pofile) $!";
	my %h = ();
	my $type;
	while (<$F>) {
		s/\r\n/\n/;
		if (/^(msgid(?:|_plural)|msgctxt) +"(.*)" *$/) {
			$type = $1;
			if ( defined( $h{$type} ) ) {
				$self->add_string( \%h );
				%h = ();
			}
			$h{$type} = $2;
		} elsif (/^msgstr(?:\[(\d*)\])? +"(.*)" *$/) {
			$type = "msgstr";
			if ( !$h{$type} ) {
				@{ $h{$type} } = ();
			}
			push @{ $h{$type} }, $2;
		} elsif (/^"(.*)" *$/) {
			if ( $type eq "msgstr" ) {
				@{ $h{$type} }[ scalar( @{ $h{$type} } ) - 1 ] .= $1;
			} else {
				$h{$type} .= $1;
			}
		} elsif (/^ *$/) {
			$self->add_string( \%h );
			%h    = ();
			$type = undef;
		} elsif (/^#/) {
			if (/^#, fuzzy/) {
				$h{fuzzy} = 1;
			} elsif (/^#:/) {
				if ( defined( $h{msgid} ) ) {
					$self->add_string( \%h );
					%h    = ();
					$type = undef;
				}
			}
		} else {
			die( "unknown line: " . $_ );
		}
	}
	$self->add_string( \%h );
	close $F;
}

sub parse {
	my $self = shift;
	my ( $pofile, $mo ) = @_;
	$self->{mo} = $mo;
	$self->read_po($pofile);
}

=head1 NAME

Locale::Msgfmt::po - class used internally by Locale::Msgfmt

=head1 SYNOPSIS

This module shouldn't be used by other software.

=head1 SEE ALSO

L<Locale::Msgfmt>

=cut

1;