[Bps-public-commit] r17017 - in Locale-Maketext-Lexicon/trunk: . lib/Locale/Maketext lib/Locale/Maketext/Extract t

clint at bestpractical.com clint at bestpractical.com
Mon Nov 24 05:51:57 EST 2008


Author: clint
Date: Mon Nov 24 05:51:57 2008
New Revision: 17017

Modified:
   Locale-Maketext-Lexicon/trunk/Changes
   Locale-Maketext-Lexicon/trunk/META.yml
   Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Extract.pm
   Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Extract/Run.pm
   Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Lexicon.pm
   Locale-Maketext-Lexicon/trunk/script/xgettext.pl
   Locale-Maketext-Lexicon/trunk/t/5-extract.t
   Locale-Maketext-Lexicon/trunk/t/8-plugin-args.t

Log:
[Changes for 0.75 - 2008-11-24]

 * Locale::Maketext::Extract / Locale::Maketext::Extract::Run
   Changed the order of extraction to:
     - extract all strings
     - then read, compile and write each PO file
   Speeds the extraction process up by a factor of the number of languages used.
   $Ext->read_po now resets the compiled entries, so that a fresh po file can
   be written.

   Also tidied up the verbose messages
   Bumped both to 0.33

 * Locale::Maketext::Extract::Run / xgettext.pl
   Added the -W | --wrap option, which forces the file location
   comments to be on separate lines, as per POEdit

   The output order of the PO file has changed to match gettext producers, so
   the arguments now appear before the file locations.

 * t/5-extract_strings.tt
   Fixed a bad SKIP plan


Modified: Locale-Maketext-Lexicon/trunk/Changes
==============================================================================
--- Locale-Maketext-Lexicon/trunk/Changes	(original)
+++ Locale-Maketext-Lexicon/trunk/Changes	Mon Nov 24 05:51:57 2008
@@ -1,3 +1,26 @@
+[Changes for 0.75 - 2008-11-24]
+
+ * Locale::Maketext::Extract / Locale::Maketext::Extract::Run
+   Changed the order of extraction to:
+     - extract all strings
+     - then read, compile and write each PO file
+   Speeds the extraction process up by a factor of the number of languages used.
+   $Ext->read_po now resets the compiled entries, so that a fresh po file can
+   be written.
+
+   Also tidied up the verbose messages
+   Bumped both to 0.33
+
+ * Locale::Maketext::Extract::Run / xgettext.pl
+   Added the -W | --wrap option, which forces the file location
+   comments to be on separate lines, as per POEdit
+
+   The output order of the PO file has changed to match gettext producers, so
+   the arguments now appear before the file locations.
+
+ * t/5-extract_strings.tt
+   Fixed a bad SKIP plan
+
 [Changes for 0.74 - 2008-11-22]
 
  * Locale::Maketext::Extract::Plugin::Perl

Modified: Locale-Maketext-Lexicon/trunk/META.yml
==============================================================================
--- Locale-Maketext-Lexicon/trunk/META.yml	(original)
+++ Locale-Maketext-Lexicon/trunk/META.yml	Mon Nov 24 05:51:57 2008
@@ -1,19 +1,28 @@
---- 
-abstract: Use other catalog formats in Maketext
-author: 
-  - Audrey Tang <cpan at audreyt.org>
+---
+abstract: 'Use other catalog formats in Maketext'
+author:
+  - 'Audrey Tang <cpan at audreyt.org>'
+build_requires:
+  Test::More: 0
 distribution_type: module
-generated_by: Module::Install version 0.68
+generated_by: 'Module::Install version 0.77'
 license: MIT
-meta-spec: 
-  url: http://module-build.sourceforge.net/META-spec-v1.3.html
-  version: 1.3
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
 name: Locale-Maketext-Lexicon
-no_index: 
-  directory: 
+no_index:
+  directory:
     - inc
     - t
-requires: 
+recommends:
+  HTML::Parser: 3.56
+  Lingua::EN::Sentence: 0.25
+  Template: 2.20
+  Template::Constants: 2.75
+  YAML: 0.66
+  YAML::Loader: 0.66
+requires:
   Locale::Maketext: 0.01
-  perl: 5.004
-version: 0.67
+  perl: 5.005
+version: 0.75

Modified: Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Extract.pm
==============================================================================
--- Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Extract.pm	(original)
+++ Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Extract.pm	Mon Nov 24 05:51:57 2008
@@ -1,5 +1,5 @@
 package Locale::Maketext::Extract;
-$Locale::Maketext::Extract::VERSION = '0.32';
+$Locale::Maketext::Extract::VERSION = '0.33';
 
 use strict;
 
@@ -262,6 +262,7 @@
                          lexicon          => {},
                          warnings         => 0,
                          verbose          => 0,
+                         wrap             => 0,
                          %params,
                       },
                       $class
@@ -321,7 +322,7 @@
             eval {
                 require $filename && 1;
                 1;
-                } or next;
+            } or next;
             push @plugins, $plugin_class->new( $params{$name} );
         }
         $self->{plugins} = \@plugins;
@@ -350,7 +351,7 @@
 
     my $header = '';
 
-    local (*LEXICON,$_);
+    local ( *LEXICON, $_ );
     open LEXICON, $file or die $!;
     while (<LEXICON>) {
         ( 1 .. /^$/ ) or last;
@@ -363,6 +364,7 @@
     require Locale::Maketext::Lexicon::Gettext;
     my $lexicon  = {};
     my $comments = {};
+    $self->set_compiled_entries( {} );
 
     if ( defined($_) ) {
         ( $lexicon, $comments )
@@ -408,8 +410,8 @@
             my @lines = split "\n", $comment;
             print LEXICON map {"# $_\n"} @lines;
         }
-        print LEXICON $self->msg_positions($msgid);
         print LEXICON $self->msg_variables($msgid);
+        print LEXICON $self->msg_positions($msgid);
         print LEXICON $self->msg_format($msgid) if $add_format_marker;
         print LEXICON $self->msg_out($msgid);
     }
@@ -444,7 +446,7 @@
                 my $entries = $plugin->entries;
                 if ( $verbose > 1 && @$entries ) {
                     push @messages,
-                          "  - "
+                          "     - "
                         . ref($plugin)
                         . ' - Strings extracted : '
                         . ( scalar @$entries );
@@ -458,8 +460,11 @@
                         # pad string
                         $string =~ s/\n/\n               /g;
                         push @messages,
-                            qq[    - Line: $line, Vars: ($vars)],
-                            qq[    - String: "$string"];
+                            sprintf( qq[       - %-8s "%s" (%s)],
+                                     $line . ':',
+                                     $string, $vars
+                            ),
+                            ;
                     }
                 }
                 $total += @$entries;
@@ -477,7 +482,7 @@
         }
     }
 
-    print STDERR " * $file - Strings extracted : $total"
+    print STDERR " * $file\n   - Total strings extracted : $total"
         . ( $error_found ? ' [ERROR ] ' : '' ) . "\n"
         if $verbose
             && ( $total || $error_found );
@@ -567,7 +572,9 @@
     my ( $self, $msgid ) = @_;
     my %files = ( map { ( " $_->[0]:$_->[1]" => 1 ) }
                   $self->compiled_entry($msgid) );
-    return join( '', '#:', sort( keys %files ), "\n" );
+    return $self->{wrap}
+        ? join( "\n", ( map { '#:' . $_ } sort( keys %files ) ), '' )
+        : join( '', '#:', sort( keys %files ), "\n" );
 }
 
 sub msg_variables {

Modified: Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Extract/Run.pm
==============================================================================
--- Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Extract/Run.pm	(original)
+++ Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Extract/Run.pm	Mon Nov 24 05:51:57 2008
@@ -1,8 +1,9 @@
 package Locale::Maketext::Extract::Run;
-$Locale::Maketext::Lexicon::Extract::Run::VERSION = '0.32';
+$Locale::Maketext::Lexicon::Extract::Run::VERSION = '0.33';
 
 use strict;
 use vars qw( @ISA @EXPORT_OK );
+use File::Spec::Functions qw(catfile);
 
 =head1 NAME
 
@@ -44,6 +45,7 @@
                               'd|default-domain:s',
                               'p|output-dir:s@',
                               'P|plugin:s@',
+                              'W|wrap!',
                               'w|warnings!',
                               'v|verbose+',
                               'h|help',
@@ -51,7 +53,7 @@
 
     help() if $opts{h};
 
-    my %extract_options = %{$self->_parse_extract_options(\%opts)};
+    my %extract_options = %{ $self->_parse_extract_options( \%opts ) };
 
     my @po = @{ $opts{o} || [ ( $opts{d} || 'messages' ) . '.po' ] };
 
@@ -67,7 +69,8 @@
         File::Find::find( {
                wanted => sub {
                    if (-d) {
-                       $File::Find::prune = /^(\.svn|blib|autogen|var|m4|local|CVS)$/;
+                       $File::Find::prune
+                           = /^(\.svn|blib|autogen|var|m4|local|CVS)$/;
                        return;
                    }
                    return
@@ -86,16 +89,13 @@
 
     my $cwd = getcwd();
 
+    my $Ext = Locale::Maketext::Extract->new(%extract_options);
     foreach my $dir ( @{ $opts{p} || ['.'] } ) {
+        $Ext->extract_file($_) for grep !/\.po$/i, @ARGV;
         foreach my $po (@po) {
-            my $Ext = Locale::Maketext::Extract->new(%extract_options);
             $Ext->read_po($po) if -r $po and -s _;
-            $Ext->extract_file($_) for grep !/\.po$/i, @ARGV;
             $Ext->compile( $opts{u} ) or next;
-
-            chdir $dir;
-            $Ext->write_po( $po, $opts{g} );
-            chdir $cwd;
+            $Ext->write_po( catfile( $dir, $po ), $opts{g} );
         }
     }
 }
@@ -103,11 +103,13 @@
 sub _parse_extract_options {
     my $self = shift;
     my $opts = shift;
-        # If a list of plugins is specified, then we use those modules
+
+    # If a list of plugins is specified, then we use those modules
     # plus their default list of file extensionse
     # and warnings enabled by default
 
-    my %extract_options = (verbose => $opts->{v});
+    my %extract_options
+        = ( verbose => $opts->{v}, wrap => $opts->{W} || 0 );
 
     if ( my $plugin_args = $opts->{P} ) {
 
@@ -115,9 +117,8 @@
         my %plugins;
 
         foreach my $param (@$plugin_args) {
-            my ( $plugin, $args ) = (
-                $param =~ /^([a-z_]\w+(?:::\w+)*)(?:=(.+))?$/i
-            );
+            my ( $plugin, $args )
+                = ( $param =~ /^([a-z_]\w+(?:::\w+)*)(?:=(.+))?$/i );
             die "Couldn't understand plugin option '$param'"
                 unless $plugin;
             my @extensions;
@@ -148,6 +149,7 @@
     return \%extract_options;
 
 }
+
 sub help {
     local $SIG{__WARN__} = sub { };
     { exec "perldoc $0"; }

Modified: Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Lexicon.pm
==============================================================================
--- Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Lexicon.pm	(original)
+++ Locale-Maketext-Lexicon/trunk/lib/Locale/Maketext/Lexicon.pm	Mon Nov 24 05:51:57 2008
@@ -1,5 +1,5 @@
 package Locale::Maketext::Lexicon;
-$Locale::Maketext::Lexicon::VERSION = '0.74';
+$Locale::Maketext::Lexicon::VERSION = '0.75';
 
 use 5.004;
 use strict;

Modified: Locale-Maketext-Lexicon/trunk/script/xgettext.pl
==============================================================================
--- Locale-Maketext-Lexicon/trunk/script/xgettext.pl	(original)
+++ Locale-Maketext-Lexicon/trunk/script/xgettext.pl	Mon Nov 24 05:51:57 2008
@@ -88,6 +88,14 @@
 Enables GNU gettext interoperability by printing C<#, perl-maketext-format>
 before each entry that has C<%> variables.
 
+=item B<-W>, B<--wrap>
+
+If wrap is enabled, then, for entries with multiple file locations, each
+location is listed on a separate line. The default is to put them all
+on a single line.
+
+Other comments are not affected.
+
 =back
 
 =head2 Plugins:

Modified: Locale-Maketext-Lexicon/trunk/t/5-extract.t
==============================================================================
--- Locale-Maketext-Lexicon/trunk/t/5-extract.t	(original)
+++ Locale-Maketext-Lexicon/trunk/t/5-extract.t	Mon Nov 24 05:51:57 2008
@@ -1,7 +1,7 @@
 #! /usr/bin/perl -w
 use lib '../lib';
 use strict;
-use Test::More tests => 98;
+use Test::More tests => 100;
 
 use_ok('Locale::Maketext::Extract');
 my $Ext = Locale::Maketext::Extract->new();
@@ -80,15 +80,15 @@
 __EXAMPLE__
 
 write_po_ok(q([% l('string',arg) %])       => <<'__EXAMPLE__', 'TT l function - variable arg');
-#: :1
 #. (arg)
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
 
 write_po_ok(q([% l('string','arg') %])     => <<'__EXAMPLE__', 'TT l function - literal arg');
-#: :1
 #. ("arg")
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -102,15 +102,15 @@
 __EXAMPLE__
 
 write_po_ok(q([% 'string' | l('arg')  %])  => <<'__EXAMPLE__', 'TT l inline filter - literal arg');
-#: :1
 #. ("arg")
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
 
 write_po_ok(q([% 'string' | l(arg)  %])    => <<'__EXAMPLE__', 'TT l inline filter - variable arg');
-#: :1
 #. (arg)
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -130,23 +130,23 @@
 __EXAMPLE__
 
 write_po_ok(q([% |l('arg') %]string[% END %]) => <<'__EXAMPLE__', 'TT l block filter - literal arg');
-#: :1
 #. ("arg")
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
 
 write_po_ok(q([% |l(arg) %]string[% END %])   => <<'__EXAMPLE__', 'TT l block filter - variable arg');
-#: :1
 #. (arg)
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
 
 
 write_po_ok(q([% FILTER l(arg) %]string[% END %])   => <<'__EXAMPLE__', 'TT block FILTER - variable arg');
-#: :1
 #. (arg)
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -157,15 +157,15 @@
 $Ext = Locale::Maketext::Extract->new(plugins=>{tt2 => '*'});
 
 write_po_ok(q([% loc('string',arg) %])       => <<'__EXAMPLE__', 'TT loc function - variable arg');
-#: :1
 #. (arg)
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
 
 write_po_ok(q([% 'string' | loc('arg')  %])  => <<'__EXAMPLE__', 'TT loc inline filter - literal arg');
-#: :1
 #. ("arg")
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -177,8 +177,8 @@
 my string
 [% END %]
 __TT__
-#: :1-3
 #. (arg1, arg2)
+#: :1-3
 msgid ""
 "\n"
 "my string\n"
@@ -190,8 +190,8 @@
 my string
 [%- END -%]
 __TT__
-#: :3
 #. (arg1, arg2)
+#: :3
 msgid "my string"
 msgstr ""
 __EXAMPLE__
@@ -209,8 +209,8 @@
 [% l('my \\ string', 'my \\ string') %]
 [% l("my \\ string", "my \\ string") %]
 __TT__
-#: :1 :2 :3
 #. ("my \\ string")
+#: :1 :2 :3
 msgid "my \\ string"
 msgstr ""
 __EXAMPLE__
@@ -218,8 +218,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 2');
 [% l('my str\'ing','my str\'ing') %]
 __TT__
-#: :1
 #. ("my str'ing")
+#: :1
 msgid "my str'ing"
 msgstr ""
 __EXAMPLE__
@@ -227,8 +227,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 3');
 [% l('my string"','my string"') %]
 __TT__
-#: :1
 #. ("my string\"")
+#: :1
 msgid "my string\""
 msgstr ""
 __EXAMPLE__
@@ -236,8 +236,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 4');
 [% l("my string'","my string'") %]
 __TT__
-#: :1
 #. ("my string'")
+#: :1
 msgid "my string'"
 msgstr ""
 __EXAMPLE__
@@ -245,8 +245,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 5');
 [% l("my \nstring","my \nstring") %]
 __TT__
-#: :1
 #. ("my \nstring")
+#: :1
 msgid ""
 "my \n"
 "string"
@@ -256,8 +256,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 6');
 [% l('my \nstring','my \nstring') %]
 __TT__
-#: :1
 #. ("my \\nstring")
+#: :1
 msgid "my \\nstring"
 msgstr ""
 __EXAMPLE__
@@ -267,8 +267,8 @@
 [% 'my \\ string' | l('my \\ string') %]
 [% "my \\ string" | l("my \\ string") %]
 __TT__
-#: :1 :2 :3
 #. ("my \\ string")
+#: :1 :2 :3
 msgid "my \\ string"
 msgstr ""
 __EXAMPLE__
@@ -276,8 +276,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 8');
 [% 'my str\'ing' | l('my str\'ing') %]
 __TT__
-#: :1
 #. ("my str'ing")
+#: :1
 msgid "my str'ing"
 msgstr ""
 __EXAMPLE__
@@ -285,8 +285,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 9');
 [% 'my string"' | l('my string"') %]
 __TT__
-#: :1
 #. ("my string\"")
+#: :1
 msgid "my string\""
 msgstr ""
 __EXAMPLE__
@@ -294,8 +294,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 10');
 [% "my string'" |l("my string'") %]
 __TT__
-#: :1
 #. ("my string'")
+#: :1
 msgid "my string'"
 msgstr ""
 __EXAMPLE__
@@ -303,8 +303,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 11');
 [% "my \nstring" |l("my \nstring") %]
 __TT__
-#: :0-1
 #. ("my \nstring")
+#: :0-1
 msgid ""
 "my \n"
 "string"
@@ -314,8 +314,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 12');
 [% 'my \nstring' |l('my \nstring') %]
 __TT__
-#: :1
 #. ("my \\nstring")
+#: :1
 msgid "my \\nstring"
 msgstr ""
 __EXAMPLE__
@@ -324,13 +324,13 @@
 [% | l('my \ string') %]my \ string[% END %]
 [% | l('my \\ string') %]my \\ string[% END %]
 __TT__
-#: :1
 #. ("my \\ string")
+#: :1
 msgid "my \\ string"
 msgstr ""
 
-#: :2
 #. ("my \\ string")
+#: :2
 msgid "my \\\\ string"
 msgstr ""
 __EXAMPLE__
@@ -338,8 +338,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 14');
 [% | l('my str\'ing') %]my str'ing[% END %]
 __TT__
-#: :1
 #. ("my str'ing")
+#: :1
 msgid "my str'ing"
 msgstr ""
 __EXAMPLE__
@@ -347,8 +347,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 15');
 [% | l('my str\'ing') %]my str\'ing[% END %]
 __TT__
-#: :1
 #. ("my str'ing")
+#: :1
 msgid "my str\\'ing"
 msgstr ""
 __EXAMPLE__
@@ -357,8 +357,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 16');
 [% | l("my str\"ing") %]my str"ing[% END %]
 __TT__
-#: :1
 #. ("my str\"ing")
+#: :1
 msgid "my str\"ing"
 msgstr ""
 __EXAMPLE__
@@ -366,8 +366,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 17');
 [% | l("my str\"ing") %]my str\"ing[% END %]
 __TT__
-#: :1
 #. ("my str\"ing")
+#: :1
 msgid "my str\\\"ing"
 msgstr ""
 __EXAMPLE__
@@ -376,8 +376,8 @@
 [% |l("my \nstring") %]my
 string[% END %]
 __TT__
-#: :1-2
 #. ("my \nstring")
+#: :1-2
 msgid ""
 "my\n"
 "string"
@@ -387,8 +387,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 19');
 [% |l('my \nstring') %]my \nstring[% END %]
 __TT__
-#: :1
 #. ("my \\nstring")
+#: :1
 msgid "my \\nstring"
 msgstr ""
 __EXAMPLE__
@@ -397,8 +397,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT key values');
 [% l('string', key1=>'value',key2=>value, key3 => value.method) %]
 __TT__
-#: :1
 #. ({ 'key1' => 'value', 'key2' => value, 'key3' => value.method })
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -406,8 +406,8 @@
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT complex args');
 [% l('string',b.method.$var(arg),c('arg').method.5) %]
 __TT__
-#: :1
 #. (b.method.$var(arg), c("arg").method.5)
+#: :1
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -416,7 +416,7 @@
 }
 
 #### BEGIN YAML TESTS ############
-SKIP: { skip('YAML.pm unavailable', 18) unless eval { require YAML };
+SKIP: { skip('YAML.pm unavailable', 7) unless eval { require YAML };
 
 extract_ok(qq(key: _"string"\n)               => "string",       "YAML double quotes");
 extract_ok(qq(key: _'string'\n)               => "string",       "YAML single quotes");
@@ -442,6 +442,8 @@
 msgstr ""
 __EXAMPLE__
 
+}
+
 #### END YAML TESTS ############
 
 
@@ -499,8 +501,8 @@
 with multilines
 },20);
 __EXAMPLE__
-#: :1
 #. (20)
+#: :1
 msgid ""
 "example %1\n"
 "with multilines\n"
@@ -513,8 +515,8 @@
 with multilines
 
 __EXAMPLE__
-#: :1
 #. (15)
+#: :1
 msgid ""
 "example %1\n"
 "with multilines\n"
@@ -526,8 +528,8 @@
 example %1
 
 __EXAMPLE__
-#: :1
 #. (10)
+#: :1
 msgid "example %1\n"
 msgstr ""
 __EXPECTED__
@@ -540,13 +542,13 @@
 example2 %1
 
 __EXAMPLE__
-#: :1
 #. (10)
+#: :1
 msgid "example1 %1\n"
 msgstr ""
 
-#: :4
 #. (5)
+#: :4
 msgid "example2 %1\n"
 msgstr ""
 __EXPECTED__
@@ -556,8 +558,8 @@
 ple1 %1
 
 __EXAMPLE__
-#: :1
 #. (10)
+#: :1
 msgid "example1 %1\n"
 msgstr ""
 __EXPECTED__
@@ -571,13 +573,13 @@
 example2 %1
 
 __EXAMPLE__
-#: :1
 #. (10)
+#: :1
 msgid "example1 %1\n"
 msgstr ""
 
-#: :5
 #. (5)
+#: :5
 msgid "example2 %1\n"
 msgstr ""
 __EXPECTED__
@@ -596,6 +598,28 @@
 msgstr ""
 __EXPECTED__
 
+## Wrapping
+
+write_po_ok(<<'__EXAMPLE__' => <<'__EXPECTED__', "wrap off");
+_('string');
+_('string');
+__EXAMPLE__
+#: :1 :2
+msgid "string"
+msgstr ""
+__EXPECTED__
+
+$Ext->{wrap} = 1;
+write_po_ok(<<'__EXAMPLE__' => <<'__EXPECTED__', "wrap on");
+_('string');
+_('string');
+__EXAMPLE__
+#: :1
+#: :2
+msgid "string"
+msgstr ""
+__EXPECTED__
+
 
 sub extract_ok {
     my ($text, $expected, $info, $verbatim) = @_;
@@ -631,4 +655,3 @@
     $Ext->clear;
 }
 
-}

Modified: Locale-Maketext-Lexicon/trunk/t/8-plugin-args.t
==============================================================================
--- Locale-Maketext-Lexicon/trunk/t/8-plugin-args.t	(original)
+++ Locale-Maketext-Lexicon/trunk/t/8-plugin-args.t	Mon Nov 24 05:51:57 2008
@@ -8,30 +8,30 @@
 
 use_ok('Locale::Maketext::Extract::Run');
 
-test( undef, { warnings => undef }, 'no options' );
+test( undef, { warnings => undef,wrap => 0 }, 'no options' );
 test( ['yaml'],
-      { warnings => 1, plugins => { yaml => [] } },
+      { warnings => 1, wrap => 0, plugins => { yaml => [] } },
       'builtin - no file types' );
 test( ['yaml=*'],
-      { warnings => 1, plugins => { yaml => ['*'] } },
+      { warnings => 1, wrap => 0, plugins => { yaml => ['*'] } },
       'builtin - all file types' );
 test( ['yaml=yml'],
-      { warnings => 1, plugins => { yaml => ['yml'] } },
+      { warnings => 1, wrap => 0, plugins => { yaml => ['yml'] } },
       'builtin - one file types' );
 test( ['yaml=yaml,yml'],
-      { warnings => 1, plugins => { yaml => [ 'yaml', 'yml' ] } },
+      { warnings => 1, wrap => 0, plugins => { yaml => [ 'yaml', 'yml' ] } },
       'builtin - two file types' );
 test( ['yaml=yaml,yml,conf'],
-      { warnings => 1, plugins => { yaml => [ 'yaml', 'yml', 'conf' ] } },
+      { warnings => 1, wrap => 0, plugins => { yaml => [ 'yaml', 'yml', 'conf' ] } },
       'builtin - three file types' );
 test( ['yaml=yaml,*,conf'],
-      { warnings => 1, plugins => { yaml => ['*'] } },
+      { warnings => 1, wrap => 0, plugins => { yaml => ['*'] } },
       'builtin - all plus file types' );
 test( ['yaml=.yaml,.conf'],
-      { warnings => 1, plugins => { yaml => [ 'yaml', 'conf' ] } },
+      { warnings => 1, wrap => 0, plugins => { yaml => [ 'yaml', 'conf' ] } },
       'builtin - trim leading period' );
 test( ['My::Module=.yaml,.conf'],
-      { warnings => 1, plugins => { 'My::Module' => [ 'yaml', 'conf' ] } },
+      { warnings => 1, wrap => 0, plugins => { 'My::Module' => [ 'yaml', 'conf' ] } },
       'custom - trim leading period' );
 test_fail( ['y~aml=..yaml,.conf'],
            q(Couldn't understand plugin option 'y~aml=..yaml,.conf'),



More information about the Bps-public-commit mailing list