r38790 - in /branches/upstream/liblocale-msgfmt-perl/current: ./ dev/ lib/Locale/ lib/Locale/Msgfmt/ t/ t/samples/
ryan52-guest at users.alioth.debian.org
ryan52-guest at users.alioth.debian.org
Fri Jun 26 23:32:10 UTC 2009
Author: ryan52-guest
Date: Fri Jun 26 23:32:06 2009
New Revision: 38790
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=38790
Log:
[svn-upgrade] Integrating new upstream version, liblocale-msgfmt-perl (0.06)
Added:
branches/upstream/liblocale-msgfmt-perl/current/dev/compare-all (with props)
branches/upstream/liblocale-msgfmt-perl/current/t/samples/build (with props)
branches/upstream/liblocale-msgfmt-perl/current/t/samples/context.mo (with props)
branches/upstream/liblocale-msgfmt-perl/current/t/samples/context.po
branches/upstream/liblocale-msgfmt-perl/current/t/samples/ngettext.mo (with props)
branches/upstream/liblocale-msgfmt-perl/current/t/samples/ngettext.po
Modified:
branches/upstream/liblocale-msgfmt-perl/current/Changes
branches/upstream/liblocale-msgfmt-perl/current/MANIFEST
branches/upstream/liblocale-msgfmt-perl/current/META.yml
branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt.pm
branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/Utils.pm
branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/mo.pm
branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/po.pm
branches/upstream/liblocale-msgfmt-perl/current/t/msgfmt.t
Modified: branches/upstream/liblocale-msgfmt-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/Changes?rev=38790&op=diff
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/Changes (original)
+++ branches/upstream/liblocale-msgfmt-perl/current/Changes Fri Jun 26 23:32:06 2009
@@ -1,4 +1,8 @@
Revision history for Locale-Msgfmt
+
+0.06 Jun 26, 2009
+ add support for contexts
+ add support for ngettext
0.05 Jun 25, 2009
don't run the external script from the tests
Modified: branches/upstream/liblocale-msgfmt-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/MANIFEST?rev=38790&op=diff
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/MANIFEST (original)
+++ branches/upstream/liblocale-msgfmt-perl/current/MANIFEST Fri Jun 26 23:32:06 2009
@@ -2,6 +2,7 @@
Build.PL
Changes
dev/compare
+dev/compare-all
dev/dump-mo
dev/dump-po
lib/Locale/Msgfmt.pm
@@ -13,7 +14,12 @@
t/00-load.t
t/msgfmt.t
t/pod.t
+t/samples/build
+t/samples/context.mo
+t/samples/context.po
t/samples/fr-fr.mo
t/samples/fr-fr.po
+t/samples/ngettext.mo
+t/samples/ngettext.po
Makefile.PL
META.yml
Modified: branches/upstream/liblocale-msgfmt-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/META.yml?rev=38790&op=diff
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/META.yml (original)
+++ branches/upstream/liblocale-msgfmt-perl/current/META.yml Fri Jun 26 23:32:06 2009
@@ -1,6 +1,6 @@
---
name: Locale-Msgfmt
-version: 0.05
+version: 0.06
author:
- 'Ryan Niebur <ryanryan52 at gmail.com>'
abstract: Compile .po files to .mo files
@@ -12,16 +12,16 @@
provides:
Locale::Msgfmt:
file: lib/Locale/Msgfmt.pm
- version: 0.05
+ version: 0.06
Locale::Msgfmt::Utils:
file: lib/Locale/Msgfmt/Utils.pm
- version: 0.05
+ version: 0.06
Locale::Msgfmt::mo:
file: lib/Locale/Msgfmt/mo.pm
- version: 0.05
+ version: 0.06
Locale::Msgfmt::po:
file: lib/Locale/Msgfmt/po.pm
- version: 0.05
+ version: 0.06
generated_by: Module::Build version 0.33
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
Added: branches/upstream/liblocale-msgfmt-perl/current/dev/compare-all
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/dev/compare-all?rev=38790&op=file
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/dev/compare-all (added)
+++ branches/upstream/liblocale-msgfmt-perl/current/dev/compare-all Fri Jun 26 23:32:06 2009
@@ -1,0 +1,5 @@
+#!/bin/sh
+
+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
Propchange: branches/upstream/liblocale-msgfmt-perl/current/dev/compare-all
------------------------------------------------------------------------------
svn:executable = *
Modified: branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt.pm?rev=38790&op=diff
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt.pm (original)
+++ branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt.pm Fri Jun 26 23:32:06 2009
@@ -12,7 +12,7 @@
our @EXPORT = qw/msgfmt msgfmt_dir/;
-our $VERSION = '0.05';
+our $VERSION = '0.06';
sub msgfmt {
my $hash = shift;
Modified: branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/Utils.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/Utils.pm?rev=38790&op=diff
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/Utils.pm (original)
+++ branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/Utils.pm Fri Jun 26 23:32:06 2009
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.05';
+our $VERSION = '0.06';
sub character {
return map {pack "N*", $_} @_;
@@ -49,4 +49,8 @@
return null_terminate("");
}
+sub eot {
+ return chr(4);
+}
+
1;
Modified: branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/mo.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/mo.pm?rev=38790&op=diff
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/mo.pm (original)
+++ branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/mo.pm Fri Jun 26 23:32:06 2009
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '0.05';
+our $VERSION = '0.06';
use Locale::Msgfmt::Utils;
Modified: branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/po.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/po.pm?rev=38790&op=diff
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/po.pm (original)
+++ branches/upstream/liblocale-msgfmt-perl/current/lib/Locale/Msgfmt/po.pm Fri Jun 26 23:32:06 2009
@@ -1,9 +1,11 @@
package Locale::Msgfmt::po;
+
+use Locale::Msgfmt::Utils;
use strict;
use warnings;
-our $VERSION = '0.05';
+our $VERSION = '0.06';
sub new {
my $class = shift;
@@ -26,8 +28,21 @@
my %h = %{$hash};
return if !(defined($h{msgid}) && defined($h{msgstr}));
return if ($h{fuzzy} && !$self->{fuzzy} && length($h{msgid}) > 0);
- return if($h{msgstr} eq "");
- $self->{mo}->add_string(cleanup_string($h{msgid}), cleanup_string($h{msgstr}));
+ 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 {
@@ -39,16 +54,27 @@
my $type;
while (<F>) {
s/\r\n/\n/;
- if(/^(msgid|msgstr) +"(.*)" *$/) {
+ if(/^(msgid(?:|_plural)|msgctxt) +"(.*)" *$/) {
$type = $1;
- if($type eq "msgid" && defined($h{msgid})) {
+ 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(/^"(.*)" *$/) {
- $h{$type} .= $1;
+ if($type eq "msgstr") {
+ @{$h{$type}}[scalar(@{$h{$type}}) - 1] .= $1;
+ } else {
+ $h{$type} .= $1;
+ }
}
elsif(/^ *$/) {
$self->add_string(\%h);
Modified: branches/upstream/liblocale-msgfmt-perl/current/t/msgfmt.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/t/msgfmt.t?rev=38790&op=diff
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/t/msgfmt.t (original)
+++ branches/upstream/liblocale-msgfmt-perl/current/t/msgfmt.t Fri Jun 26 23:32:06 2009
@@ -1,23 +1,36 @@
#!perl
-use Test::More tests => 1;
+use Test::More tests => 3;
use Locale::Msgfmt;
use File::Temp;
SKIP: {
- skip "Test needs Locale::Maketext::Gettext", 1 if(!eval("use Locale::Maketext::Gettext; 1;"));
- my %h;
- my $good = "";
- %h = read_mo("t/samples/fr-fr.mo");
- foreach(sort keys %h){$good .= $_ . " " . $h{$_} . "\n";};
- ($fh, $filename) = File::Temp::tempfile();
- close $fh;
- msgfmt({in => "t/samples/fr-fr.po", out => $filename});
- my $test = "";
- %h = read_mo($filename);
- foreach(sort keys %h){$test .= $_ . " " . $h{$_} . "\n";};
- is($test, $good);
- unlink($filename);
+ skip "Test needs Locale::Maketext::Gettext", 3 if(!eval("use Locale::Maketext::Gettext; 1;"));
+ sub my_read_mo {
+ my $str = "";
+ my %h = read_mo(shift);
+ foreach(sort keys %h){$str .= $_ . " " . $h{$_} . "\n";};
+ return $str;
+ }
+ sub my_msgfmt {
+ my ($fh, $filename) = File::Temp::tempfile();
+ close $fh;
+ msgfmt({in => shift, out => $filename});
+ return $filename;
+ }
+ sub do_one_test {
+ my $basename = shift;
+ my $po = "t/samples/" . $basename . ".po";
+ my $mo = "t/samples/" . $basename . ".mo";
+ my $good = my_read_mo($mo);
+ my $filename = my_msgfmt($po);
+ my $test = my_read_mo($filename);
+ is($test, $good);
+ unlink($filename);
+ }
+ do_one_test("fr-fr");
+ do_one_test("context");
+ do_one_test("ngettext");
}
Added: branches/upstream/liblocale-msgfmt-perl/current/t/samples/build
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/t/samples/build?rev=38790&op=file
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/t/samples/build (added)
+++ branches/upstream/liblocale-msgfmt-perl/current/t/samples/build Fri Jun 26 23:32:06 2009
@@ -1,0 +1,8 @@
+#!/bin/sh
+
+cd `dirname $0`
+rm *.mo
+for PO in *.po; do
+ MO=$(echo $PO | sed 's/po$/mo/')
+ msgfmt -o $MO $PO
+done
Propchange: branches/upstream/liblocale-msgfmt-perl/current/t/samples/build
------------------------------------------------------------------------------
svn:executable = *
Added: branches/upstream/liblocale-msgfmt-perl/current/t/samples/context.mo
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/t/samples/context.mo?rev=38790&op=file
==============================================================================
Binary file - no diff available.
Propchange: branches/upstream/liblocale-msgfmt-perl/current/t/samples/context.mo
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: branches/upstream/liblocale-msgfmt-perl/current/t/samples/context.po
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/t/samples/context.po?rev=38790&op=file
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/t/samples/context.po (added)
+++ branches/upstream/liblocale-msgfmt-perl/current/t/samples/context.po Fri Jun 26 23:32:06 2009
@@ -1,0 +1,8 @@
+msgctxt "one"
+msgid "foo"
+msgstr "bar"
+
+msgctxt "two"
+msgid "foo"
+msgstr "baz"
+
Added: branches/upstream/liblocale-msgfmt-perl/current/t/samples/ngettext.mo
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/t/samples/ngettext.mo?rev=38790&op=file
==============================================================================
Binary file - no diff available.
Propchange: branches/upstream/liblocale-msgfmt-perl/current/t/samples/ngettext.mo
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: branches/upstream/liblocale-msgfmt-perl/current/t/samples/ngettext.po
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblocale-msgfmt-perl/current/t/samples/ngettext.po?rev=38790&op=file
==============================================================================
--- branches/upstream/liblocale-msgfmt-perl/current/t/samples/ngettext.po (added)
+++ branches/upstream/liblocale-msgfmt-perl/current/t/samples/ngettext.po Fri Jun 26 23:32:06 2009
@@ -1,0 +1,5 @@
+msgid "thing"
+msgid_plural "things"
+msgstr[0] "1 foo"
+msgstr[1] "%s foos"
+
More information about the Pkg-perl-cvs-commits
mailing list