r38796 - in /trunk/liblocale-msgfmt-perl: ./ bin/ dev/ lib/Locale/ lib/Locale/Msgfmt/ t/ t/samples/
ryan52-guest at users.alioth.debian.org
ryan52-guest at users.alioth.debian.org
Sat Jun 27 02:49:52 UTC 2009
Author: ryan52-guest
Date: Sat Jun 27 02:49:48 2009
New Revision: 38796
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=38796
Log:
new upstream version
Added:
trunk/liblocale-msgfmt-perl/t/interface.t
- copied unchanged from r38795, branches/upstream/liblocale-msgfmt-perl/current/t/interface.t
trunk/liblocale-msgfmt-perl/t/samples/basic.mo
- copied unchanged from r38795, branches/upstream/liblocale-msgfmt-perl/current/t/samples/basic.mo
trunk/liblocale-msgfmt-perl/t/samples/basic.po
- copied unchanged from r38795, branches/upstream/liblocale-msgfmt-perl/current/t/samples/basic.po
trunk/liblocale-msgfmt-perl/t/samples/fuzz.mo
- copied unchanged from r38795, branches/upstream/liblocale-msgfmt-perl/current/t/samples/fuzz.mo
trunk/liblocale-msgfmt-perl/t/samples/ja.mo
- copied unchanged from r38795, branches/upstream/liblocale-msgfmt-perl/current/t/samples/ja.mo
trunk/liblocale-msgfmt-perl/t/samples/ja.po
- copied unchanged from r38795, branches/upstream/liblocale-msgfmt-perl/current/t/samples/ja.po
Removed:
trunk/liblocale-msgfmt-perl/t/samples/fr-fr.mo
trunk/liblocale-msgfmt-perl/t/samples/fr-fr.po
Modified:
trunk/liblocale-msgfmt-perl/Build.PL
trunk/liblocale-msgfmt-perl/Changes
trunk/liblocale-msgfmt-perl/MANIFEST
trunk/liblocale-msgfmt-perl/META.yml
trunk/liblocale-msgfmt-perl/Makefile.PL
trunk/liblocale-msgfmt-perl/bin/msgfmt.pl
trunk/liblocale-msgfmt-perl/dev/compare
trunk/liblocale-msgfmt-perl/dev/compare-all
trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt.pm
trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/Utils.pm
trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/mo.pm
trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/po.pm
trunk/liblocale-msgfmt-perl/t/msgfmt.t
trunk/liblocale-msgfmt-perl/t/samples/build
Modified: trunk/liblocale-msgfmt-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/Build.PL?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/Build.PL (original)
+++ trunk/liblocale-msgfmt-perl/Build.PL Sat Jun 27 02:49:48 2009
@@ -9,7 +9,7 @@
dist_version_from => 'lib/Locale/Msgfmt.pm',
build_requires => {
'Test::More' => 0,
- $ENV{AUTOMATED_TESTING} ? ('Locale::Maketext::Gettext' => 0) : (),
+ 'Locale::Maketext::Gettext' => 1.28,
},
add_to_cleanup => [ 'Locale-Msgfmt-*' ],
create_makefile_pl => 'traditional',
Modified: trunk/liblocale-msgfmt-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/Changes?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/Changes (original)
+++ trunk/liblocale-msgfmt-perl/Changes Sat Jun 27 02:49:48 2009
@@ -1,21 +1,33 @@
Revision history for Locale-Msgfmt
+0.07 Jun 26, 2009
+ - make the interface a bit nicer
+ - remove the msgfmt_dir function (msgfmt now handles this if
+ the input file is a directory)
+ - more tests
+ - always build_require Locale::Maketext::Gettext, now it will
+ install correctly
+ - improved POD
+ - switch the "sample" translation used for the tests to
+ japanese instead of french, since the japanese includes
+ copyright and license information
+
0.06 Jun 26, 2009
- add support for contexts
- add support for ngettext
+ - add support for contexts
+ - add support for ngettext
0.05 Jun 25, 2009
- don't run the external script from the tests
+ - don't run the external script from the tests
0.04 Jun 25, 2009
- if running from CPAN testers, require Locale::Maketext::Gettext too
+ - if running from CPAN testers, require Locale::Maketext::Gettext too
0.03 Jun 24, 2009
- fix on perl 5.8
+ - fix on perl 5.8
0.02 Jun 24, 2009
- add a msgfmt_dir function to convert all of the .po files in a directory
+ - add a msgfmt_dir function to convert all of the .po files in a directory
0.01 Jun 24, 2009
- First version, released on an unsuspecting world.
+ - First version, released on an unsuspecting world.
Modified: trunk/liblocale-msgfmt-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/MANIFEST?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/MANIFEST (original)
+++ trunk/liblocale-msgfmt-perl/MANIFEST Sat Jun 27 02:49:48 2009
@@ -12,13 +12,17 @@
MANIFEST This list of files
README
t/00-load.t
+t/interface.t
t/msgfmt.t
t/pod.t
+t/samples/basic.mo
+t/samples/basic.po
t/samples/build
t/samples/context.mo
t/samples/context.po
-t/samples/fr-fr.mo
-t/samples/fr-fr.po
+t/samples/fuzz.mo
+t/samples/ja.mo
+t/samples/ja.po
t/samples/ngettext.mo
t/samples/ngettext.po
Makefile.PL
Modified: trunk/liblocale-msgfmt-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/META.yml?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/META.yml (original)
+++ trunk/liblocale-msgfmt-perl/META.yml Sat Jun 27 02:49:48 2009
@@ -1,6 +1,6 @@
---
name: Locale-Msgfmt
-version: 0.06
+version: 0.07
author:
- 'Ryan Niebur <ryanryan52 at gmail.com>'
abstract: Compile .po files to .mo files
@@ -8,20 +8,21 @@
resources:
license: http://dev.perl.org/licenses/
build_requires:
+ Locale::Maketext::Gettext: 1.28
Test::More: 0
provides:
Locale::Msgfmt:
file: lib/Locale/Msgfmt.pm
- version: 0.06
+ version: 0.07
Locale::Msgfmt::Utils:
file: lib/Locale/Msgfmt/Utils.pm
- version: 0.06
+ version: 0.07
Locale::Msgfmt::mo:
file: lib/Locale/Msgfmt/mo.pm
- version: 0.06
+ version: 0.07
Locale::Msgfmt::po:
file: lib/Locale/Msgfmt/po.pm
- version: 0.06
+ version: 0.07
generated_by: Module::Build version 0.33
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
Modified: trunk/liblocale-msgfmt-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/Makefile.PL?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/Makefile.PL (original)
+++ trunk/liblocale-msgfmt-perl/Makefile.PL Sat Jun 27 02:49:48 2009
@@ -5,6 +5,7 @@
'NAME' => 'Locale::Msgfmt',
'VERSION_FROM' => 'lib/Locale/Msgfmt.pm',
'PREREQ_PM' => {
+ 'Locale::Maketext::Gettext' => '1.28',
'Test::More' => 0
},
'INSTALLDIRS' => 'site',
Modified: trunk/liblocale-msgfmt-perl/bin/msgfmt.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/bin/msgfmt.pl?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/bin/msgfmt.pl (original)
+++ trunk/liblocale-msgfmt-perl/bin/msgfmt.pl Sat Jun 27 02:49:48 2009
@@ -9,9 +9,26 @@
my($opt_o, $opt_f);
GetOptions("output-file|o=s" => \$opt_o, "use-fuzzy|f" => \$opt_f);
my $in = shift;
-if(!(defined($in) && defined($opt_o))) {
- print "usage: $0 [-f] -o output.mo input.po\n";
- exit(1);
-}
msgfmt({in => $in, out => $opt_o, fuzzy => $opt_f});
+
+=head1 NAME
+
+msgfmt.pl - Compile .po files to .mo files
+
+=head1 SYNOPSIS
+
+This script does the same thing as msgfmt from GNU gettext-tools,
+except this is pure Perl. Because it's pure Perl, it's more portable
+and more easily installed (via CPAN). It has two other advantages.
+First, it supports directories, so you can have it process a full
+directory of .po files. Second, it can guess the output file (if you
+don't specify the -o option). If the input is a file, it will
+s/po$/mo/ to figure out the output file. If the input is a directory,
+it will write the .mo files to the same directory.
+
+=head1 SEE ALSO
+
+L<Locale::Msgfmt>
+
+=cut
Modified: trunk/liblocale-msgfmt-perl/dev/compare
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/dev/compare?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/dev/compare (original)
+++ trunk/liblocale-msgfmt-perl/dev/compare Sat Jun 27 02:49:48 2009
@@ -1,6 +1,6 @@
#!/bin/sh
-echo $1
+echo "$@"
./bin/msgfmt.pl -o mine "$@"
./dev/dump-mo mine > mine.out
msgfmt -o gnu "$@"
Modified: trunk/liblocale-msgfmt-perl/dev/compare-all
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/dev/compare-all?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/dev/compare-all (original)
+++ trunk/liblocale-msgfmt-perl/dev/compare-all Sat Jun 27 02:49:48 2009
@@ -2,4 +2,5 @@
rm ~/padre/list
find ~/padre/ | grep -v "\.svn" | grep "\.po$" > ~/padre/list
-for i in $(cat ~/padre/list); do PERL5LIB=./lib/ ./dev/compare $i; done
+for i in $(cat ~/padre/list); do PERL5LIB=./lib/ ./dev/compare $i; PERL5LIB=./lib/ ./dev/compare -f $i; done
+rm gnu.out mine.out gnu mine
Modified: trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt.pm?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt.pm (original)
+++ trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt.pm Sat Jun 27 02:49:48 2009
@@ -10,15 +10,46 @@
use base 'Exporter';
-our @EXPORT = qw/msgfmt msgfmt_dir/;
+our @EXPORT = qw/msgfmt/;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
sub msgfmt {
my $hash = shift;
+ if(!defined($hash)) {
+ die("error: must give input");
+ }
+ if(!(ref($hash) eq "HASH")) {
+ $hash = {in => $hash};
+ }
+ if(!defined($hash->{in}) or !length($hash->{in})) {
+ die("error: must give an input file");
+ }
+ if(! -e $hash->{in}) {
+ die("error: input does not exist");
+ }
+ if(-d $hash->{in}) {
+ return _msgfmt_dir($hash);
+ } else {
+ return _msgfmt($hash);
+ }
+}
+
+sub _msgfmt {
+ my $hash = shift;
+ if(! defined($hash->{in})) {
+ die("error: must give an input file");
+ }
if(! -f $hash->{in}) {
- print "error: input file does not exist\n";
- exit(1);
+ die("error: input file does not exist");
+ }
+ if(! defined($hash->{out})) {
+ if($hash->{in} =~ /\.po$/) {
+ $hash->{out} = $hash->{in};
+ $hash->{out} =~ s/po$/mo/;
+ } else {
+ die("error: must give an output file");
+ }
}
my $mo = Locale::Msgfmt::mo->new();
$mo->initialize();
@@ -28,11 +59,10 @@
$mo->out($hash->{out});
}
-sub msgfmt_dir {
+sub _msgfmt_dir {
my $hash = shift;
if(! -d $hash->{in}) {
- print "error: input directory does not exist\n";
- exit(1);
+ die("error: input directory does not exist");
}
if(! defined($hash->{out})) {
$hash->{out} = $hash->{in};
@@ -56,7 +86,7 @@
my %newhash = (%{$hash});
$newhash{in} = $_;
$newhash{out} = $files{$_};
- msgfmt(\%newhash);
+ _msgfmt(\%newhash);
}
}
@@ -69,12 +99,32 @@
=head1 SYNOPSIS
This module does the same thing as msgfmt from GNU gettext-tools,
-except this is pure Perl.
+except this is pure Perl. The interface is best explained through
+examples:
use Locale::Msgfmt;
+ # compile po/fr.po into po/fr.mo
msgfmt({in => "po/fr.po", out => "po/fr.mo"});
- msgfmt_dir({in => "po/"});
+ # compile po/fr.po into po/fr.mo and include fuzzy translations
+ msgfmt({in => "po/fr.po", out => "po/fr.mo", fuzzy => 1});
+ # compile all the .po files in the po directory, and write the .mo
+ # files to the po directory
+ msgfmt("po/");
+ # compile all the .po files in the po directory, and write the .mo
+ # files to the po directory, and include fuzzy translations
+ msgfmt({in => "po/", fuzzy => 1});
+ # compile all the .po files in the po directory, and write the .mo
+ # files to the output directory, creating the output directory if
+ # it doesn't already exist
+ msgfmt({in => "po/", out => "output/"});
+ # compile all the .po files in the po directory, and write the .mo
+ # files to the output directory, and include fuzzy translations
+ msgfmt({in => "po/", out => "output/", fuzzy => 1});
+ # compile po/fr.po into po/fr.mo
+ msgfmt("po/fr.po");
+ # compile po/fr.po into po/fr.mo and include fuzzy translations
+ msgfmt({in => "po/fr.po", fuzzy => 1});
=head1 COPYRIGHT & LICENSE
Modified: trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/Utils.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/Utils.pm?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/Utils.pm (original)
+++ trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/Utils.pm Sat Jun 27 02:49:48 2009
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
sub character {
return map {pack "N*", $_} @_;
@@ -53,4 +53,18 @@
return chr(4);
}
+=head1 NAME
+
+Locale::Msgfmt::Utils - functions used internally by Locale::Msgfmt
+
+=head1 SYNOPSIS
+
+This module shouldn't be used by other software.
+
+=head1 SEE ALSO
+
+L<Locale::Msgfmt>
+
+=cut
+
1;
Modified: trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/mo.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/mo.pm?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/mo.pm (original)
+++ trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/mo.pm Sat Jun 27 02:49:48 2009
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
use Locale::Msgfmt::Utils;
@@ -67,4 +67,18 @@
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;
Modified: trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/po.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/po.pm?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/po.pm (original)
+++ trunk/liblocale-msgfmt-perl/lib/Locale/Msgfmt/po.pm Sat Jun 27 02:49:48 2009
@@ -5,7 +5,7 @@
use strict;
use warnings;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
sub new {
my $class = shift;
@@ -105,4 +105,18 @@
$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;
Modified: trunk/liblocale-msgfmt-perl/t/msgfmt.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/t/msgfmt.t?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/t/msgfmt.t (original)
+++ trunk/liblocale-msgfmt-perl/t/msgfmt.t Sat Jun 27 02:49:48 2009
@@ -1,12 +1,13 @@
#!perl
-use Test::More tests => 3;
+use Test::More tests => 5;
use Locale::Msgfmt;
use File::Temp;
+use File::Spec;
SKIP: {
- skip "Test needs Locale::Maketext::Gettext", 3 if(!eval("use Locale::Maketext::Gettext; 1;"));
+ skip "Test needs Locale::Maketext::Gettext", 5 if(!eval("use Locale::Maketext::Gettext; 1;"));
sub my_read_mo {
my $str = "";
my %h = read_mo(shift);
@@ -16,20 +17,33 @@
sub my_msgfmt {
my ($fh, $filename) = File::Temp::tempfile();
close $fh;
- msgfmt({in => shift, out => $filename});
+ my $in = shift;
+ my $fuzzy = 0;
+ if(shift) {
+ $fuzzy = 1;
+ }
+ msgfmt({in => $in, out => $filename, fuzzy => $fuzzy});
return $filename;
}
sub do_one_test {
my $basename = shift;
- my $po = "t/samples/" . $basename . ".po";
- my $mo = "t/samples/" . $basename . ".mo";
+ my $po = File::Spec->catfile("t", "samples", $basename . ".po");
+ my $mo = File::Spec->catfile("t", "samples", $basename . ".mo");
my $good = my_read_mo($mo);
my $filename = my_msgfmt($po);
my $test = my_read_mo($filename);
is($test, $good);
+ if($basename eq "basic") {
+ unlink($filename);
+ $filename = my_msgfmt($po, 1);
+ $good = my_read_mo(File::Spec->catfile("t", "samples", "fuzz.mo"));
+ $test = my_read_mo($filename);
+ is($test, $good);
+ }
unlink($filename);
}
- do_one_test("fr-fr");
+ do_one_test("basic");
+ do_one_test("ja");
do_one_test("context");
do_one_test("ngettext");
}
Modified: trunk/liblocale-msgfmt-perl/t/samples/build
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-msgfmt-perl/t/samples/build?rev=38796&op=diff
==============================================================================
--- trunk/liblocale-msgfmt-perl/t/samples/build (original)
+++ trunk/liblocale-msgfmt-perl/t/samples/build Sat Jun 27 02:49:48 2009
@@ -5,4 +5,7 @@
for PO in *.po; do
MO=$(echo $PO | sed 's/po$/mo/')
msgfmt -o $MO $PO
+ if [ "$PO" = "basic.po" ]; then
+ msgfmt -f -o fuzz.mo $PO
+ fi
done
More information about the Pkg-perl-cvs-commits
mailing list