/usr/share/perl5/Locale/Msgfmt/mo.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 | package Locale::Msgfmt::mo;
use strict;
use warnings;
our $VERSION = '0.14';
use Locale::Msgfmt::Utils;
sub new {
return bless {}, shift;
}
sub initialize {
my $self = shift;
$self->{magic} = "0x950412de";
$self->{format} = 0;
$self->{strings} = {};
}
sub add_string {
my ( $self, $string, $translation ) = @_;
$self->{strings}->{$string} = $translation;
}
sub prepare {
my $self = shift;
$self->{count} = scalar keys %{ $self->{strings} };
$self->{free_mem} = 28 + $self->{count} * 16;
@{ $self->{sorted} } = sort keys %{ $self->{strings} };
@{ $self->{translations} } = ();
foreach ( @{ $self->{sorted} } ) {
push @{ $self->{translations} }, $self->{strings}->{$_};
}
}
sub out {
my $self = shift;
my $file = shift;
open my $OUT, ">", $file or die "Could not open ($file) $!";
binmode $OUT;
print $OUT Locale::Msgfmt::Utils::from_hex( $self->{magic} );
print $OUT Locale::Msgfmt::Utils::character( $self->{format} );
print $OUT Locale::Msgfmt::Utils::character( $self->{count} );
print $OUT Locale::Msgfmt::Utils::character(28);
print $OUT Locale::Msgfmt::Utils::character( 28 + $self->{count} * 8 );
print $OUT Locale::Msgfmt::Utils::character(0);
print $OUT Locale::Msgfmt::Utils::character(0);
foreach ( @{ $self->{sorted} } ) {
my $length = length($_);
print $OUT Locale::Msgfmt::Utils::character($length);
print $OUT Locale::Msgfmt::Utils::character( $self->{free_mem} );
$self->{free_mem} += $length + 1;
}
foreach ( @{ $self->{translations} } ) {
my $length = length($_);
print $OUT Locale::Msgfmt::Utils::character($length);
print $OUT Locale::Msgfmt::Utils::character( $self->{free_mem} );
$self->{free_mem} += $length + 1;
}
foreach ( @{ $self->{sorted} } ) {
print $OUT Locale::Msgfmt::Utils::null_terminate($_);
}
foreach ( @{ $self->{translations} } ) {
print $OUT Locale::Msgfmt::Utils::null_terminate($_);
}
close $OUT;
}
=head1 NAME
Locale::Msgfmt::mo - 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;
|