[Bps-public-commit] r10038 - in Locale-Maketext-Lexicon: . inc inc/Module inc/Module/Install inc/Test lib/Locale/Maketext lib/Locale/Maketext/Lexicon script
audreyt at bestpractical.com
audreyt at bestpractical.com
Sat Dec 22 10:53:10 EST 2007
Author: audreyt
Date: Sat Dec 22 10:53:10 2007
New Revision: 10038
Added:
Locale-Maketext-Lexicon/MANIFEST
Locale-Maketext-Lexicon/inc/attributes.pm
Modified:
Locale-Maketext-Lexicon/Changes
Locale-Maketext-Lexicon/inc/Module/Install.pm
Locale-Maketext-Lexicon/inc/Module/Install/Base.pm
Locale-Maketext-Lexicon/inc/Module/Install/Can.pm
Locale-Maketext-Lexicon/inc/Module/Install/Fetch.pm
Locale-Maketext-Lexicon/inc/Module/Install/Include.pm
Locale-Maketext-Lexicon/inc/Module/Install/Makefile.pm
Locale-Maketext-Lexicon/inc/Module/Install/Metadata.pm
Locale-Maketext-Lexicon/inc/Module/Install/Scripts.pm
Locale-Maketext-Lexicon/inc/Module/Install/Win32.pm
Locale-Maketext-Lexicon/inc/Module/Install/WriteAll.pm
Locale-Maketext-Lexicon/inc/Test/Builder.pm
Locale-Maketext-Lexicon/inc/Test/Builder/Module.pm
Locale-Maketext-Lexicon/inc/Test/More.pm
Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon.pm
Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Auto.pm
Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Gettext.pm
Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Msgcat.pm
Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Tie.pm
Locale-Maketext-Lexicon/script/xgettext.pl
Log:
[Changes for 0.65 - 2007-12-22]
* Perl 5.9.5+ is pickier about what "being used only once" means,
so we make sure to avoid that warning.
Contributed by: Alex Vandiver
* Also restore compatibility with Perl 5.005 and earlier by avoiding
the "no warnings" pragma.
* Tidied up code style, documentation, copyright years, etc.
Modified: Locale-Maketext-Lexicon/Changes
==============================================================================
--- Locale-Maketext-Lexicon/Changes (original)
+++ Locale-Maketext-Lexicon/Changes Sat Dec 22 10:53:10 2007
@@ -1,12 +1,14 @@
-[Changes for 0.65 - 2007-07-12]
+[Changes for 0.65 - 2007-12-22]
-* Perl 5.9.5 is pickier about what "being used only once" means,
+* Perl 5.9.5+ is pickier about what "being used only once" means,
so we make sure to avoid that warning.
Contributed by: Alex Vandiver
* Also restore compatibility with Perl 5.005 and earlier by avoiding
the "no warnings" pragma.
+* Tidied up code style, documentation, copyright years, etc.
+
[Changes for 0.64 - 2007-05-28]
* Locale::Maketext::Extract: Extraction wasn't able to deal with escaped
Added: Locale-Maketext-Lexicon/MANIFEST
==============================================================================
--- (empty file)
+++ Locale-Maketext-Lexicon/MANIFEST Sat Dec 22 10:53:10 2007
@@ -0,0 +1,50 @@
+AUTHORS
+Changes
+docs/webl10n.html
+docs/webl10n.zh-tw.html
+inc/attributes.pm
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Include.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Scripts.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+inc/Test/Builder.pm
+inc/Test/Builder/Module.pm
+inc/Test/More.pm
+lib/Locale/Maketext/Extract.pm
+lib/Locale/Maketext/Extract/Run.pm
+lib/Locale/Maketext/Lexicon.pm
+lib/Locale/Maketext/Lexicon/Auto.pm
+lib/Locale/Maketext/Lexicon/Gettext.pm
+lib/Locale/Maketext/Lexicon/Msgcat.pm
+lib/Locale/Maketext/Lexicon/Tie.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+script/xgettext.pl
+t/1-basic.t
+t/2-lmg.t
+t/3-big-endian.t
+t/4-encodings.t
+t/5-extract.t
+t/6-gettext.t
+t/99-bug-import-for-subclasses.t
+t/gencat.m
+t/locale/en/LC_MESSAGES/test.mo
+t/locale/en/LC_MESSAGES/test_be.mo
+t/locale/en/LC_MESSAGES/test_utf8.mo
+t/locale/zh_CN/LC_MESSAGES/test.mo
+t/locale/zh_CN/LC_MESSAGES/test_be.mo
+t/locale/zh_CN/LC_MESSAGES/test_utf8.mo
+t/locale/zh_TW/LC_MESSAGES/test.mo
+t/locale/zh_TW/LC_MESSAGES/test_be.mo
+t/locale/zh_TW/LC_MESSAGES/test_utf8.mo
+t/messages.mo
+t/messages.po
+t/T_L10N.pm
Modified: Locale-Maketext-Lexicon/inc/Module/Install.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install.pm Sat Dec 22 10:53:10 2007
@@ -28,7 +28,7 @@
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.67';
+ $VERSION = '0.68';
}
# Whether or not inc::Module::Install is actually loaded, the
Modified: Locale-Maketext-Lexicon/inc/Module/Install/Base.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install/Base.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install/Base.pm Sat Dec 22 10:53:10 2007
@@ -1,7 +1,7 @@
#line 1
package Module::Install::Base;
-$VERSION = '0.67';
+$VERSION = '0.68';
# Suspend handler for "redefined" warnings
BEGIN {
Modified: Locale-Maketext-Lexicon/inc/Module/Install/Can.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install/Can.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install/Can.pm Sat Dec 22 10:53:10 2007
@@ -11,7 +11,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: Locale-Maketext-Lexicon/inc/Module/Install/Fetch.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install/Fetch.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install/Fetch.pm Sat Dec 22 10:53:10 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: Locale-Maketext-Lexicon/inc/Module/Install/Include.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install/Include.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install/Include.pm Sat Dec 22 10:53:10 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: Locale-Maketext-Lexicon/inc/Module/Install/Makefile.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install/Makefile.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install/Makefile.pm Sat Dec 22 10:53:10 2007
@@ -7,7 +7,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: Locale-Maketext-Lexicon/inc/Module/Install/Metadata.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install/Metadata.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install/Metadata.pm Sat Dec 22 10:53:10 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: Locale-Maketext-Lexicon/inc/Module/Install/Scripts.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install/Scripts.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install/Scripts.pm Sat Dec 22 10:53:10 2007
@@ -7,7 +7,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: Locale-Maketext-Lexicon/inc/Module/Install/Win32.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install/Win32.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install/Win32.pm Sat Dec 22 10:53:10 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: Locale-Maketext-Lexicon/inc/Module/Install/WriteAll.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Module/Install/WriteAll.pm (original)
+++ Locale-Maketext-Lexicon/inc/Module/Install/WriteAll.pm Sat Dec 22 10:53:10 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: Locale-Maketext-Lexicon/inc/Test/Builder.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Test/Builder.pm (original)
+++ Locale-Maketext-Lexicon/inc/Test/Builder.pm Sat Dec 22 10:53:10 2007
@@ -9,7 +9,7 @@
use strict;
use vars qw($VERSION);
-$VERSION = '0.70';
+$VERSION = '0.72';
$VERSION = eval $VERSION; # make the alpha version come out as a number
# Make Test::Builder thread-safe for ithreads.
@@ -711,8 +711,8 @@
my $maybe_fh = shift;
return 0 unless defined $maybe_fh;
- return 1 if ref $maybe_fh eq 'GLOB'; # its a glob
- return 1 if ref \$maybe_fh eq 'GLOB'; # its a glob ref
+ return 1 if ref $maybe_fh eq 'GLOB'; # its a glob ref
+ return 1 if ref \$maybe_fh eq 'GLOB'; # its a glob
return eval { $maybe_fh->isa("IO::Handle") } ||
# 5.5.4's tied() and can() doesn't like getting undef
Modified: Locale-Maketext-Lexicon/inc/Test/Builder/Module.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Test/Builder/Module.pm (original)
+++ Locale-Maketext-Lexicon/inc/Test/Builder/Module.pm Sat Dec 22 10:53:10 2007
@@ -6,7 +6,7 @@
require Exporter;
@ISA = qw(Exporter);
-$VERSION = '0.68';
+$VERSION = '0.72';
use strict;
Modified: Locale-Maketext-Lexicon/inc/Test/More.pm
==============================================================================
--- Locale-Maketext-Lexicon/inc/Test/More.pm (original)
+++ Locale-Maketext-Lexicon/inc/Test/More.pm Sat Dec 22 10:53:10 2007
@@ -17,7 +17,7 @@
use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS $TODO);
-$VERSION = '0.70';
+$VERSION = '0.72';
$VERSION = eval $VERSION; # make the alpha version come out as a number
use Test::Builder::Module;
@@ -314,6 +314,12 @@
use vars qw(@Data_Stack %Refs_Seen);
my $DNE = bless [], 'Does::Not::Exist';
+
+sub _dne {
+ ref $_[0] eq ref $DNE;
+}
+
+
sub is_deeply {
my $tb = Test::More->builder;
@@ -386,8 +392,8 @@
foreach my $idx (0..$#vals) {
my $val = $vals[$idx];
$vals[$idx] = !defined $val ? 'undef' :
- $val eq $DNE ? "Does not exist" :
- ref $val ? "$val" :
+ _dne($val) ? "Does not exist" :
+ ref $val ? "$val" :
"'$val'";
}
@@ -411,7 +417,7 @@
return '';
}
-#line 919
+#line 925
sub diag {
my $tb = Test::More->builder;
@@ -420,7 +426,7 @@
}
-#line 988
+#line 994
#'#
sub skip {
@@ -448,7 +454,7 @@
}
-#line 1075
+#line 1081
sub todo_skip {
my($why, $how_many) = @_;
@@ -469,7 +475,7 @@
last TODO;
}
-#line 1128
+#line 1134
sub BAIL_OUT {
my $reason = shift;
@@ -478,7 +484,7 @@
$tb->BAIL_OUT($reason);
}
-#line 1167
+#line 1173
#'#
sub eq_array {
@@ -536,7 +542,7 @@
if( defined $e1 xor defined $e2 ) {
$ok = 0;
}
- elsif ( $e1 == $DNE xor $e2 == $DNE ) {
+ elsif ( _dne($e1) xor _dne($e2) ) {
$ok = 0;
}
elsif ( $same_ref and ($e1 eq $e2) ) {
@@ -602,7 +608,7 @@
}
-#line 1298
+#line 1304
sub eq_hash {
local @Data_Stack;
@@ -635,7 +641,7 @@
return $ok;
}
-#line 1355
+#line 1361
sub eq_set {
my($a1, $a2) = @_;
@@ -661,6 +667,6 @@
);
}
-#line 1545
+#line 1551
1;
Added: Locale-Maketext-Lexicon/inc/attributes.pm
==============================================================================
--- (empty file)
+++ Locale-Maketext-Lexicon/inc/attributes.pm Sat Dec 22 10:53:10 2007
@@ -0,0 +1,96 @@
+#line 1
+package attributes;
+
+our $VERSION = 0.08;
+
+ at EXPORT_OK = qw(get reftype);
+ at EXPORT = ();
+%EXPORT_TAGS = (ALL => [@EXPORT, @EXPORT_OK]);
+
+use strict;
+
+sub croak {
+ require Carp;
+ goto &Carp::croak;
+}
+
+sub carp {
+ require Carp;
+ goto &Carp::carp;
+}
+
+## forward declaration(s) rather than wrapping the bootstrap call in BEGIN{}
+#sub reftype ($) ;
+#sub _fetch_attrs ($) ;
+#sub _guess_stash ($) ;
+#sub _modify_attrs ;
+#
+# The extra trips through newATTRSUB in the interpreter wipe out any savings
+# from avoiding the BEGIN block. Just do the bootstrap now.
+BEGIN { bootstrap attributes }
+
+sub import {
+ @_ > 2 && ref $_[2] or do {
+ require Exporter;
+ goto &Exporter::import;
+ };
+ my (undef,$home_stash,$svref, at attrs) = @_;
+
+ my $svtype = uc reftype($svref);
+ my $pkgmeth;
+ $pkgmeth = UNIVERSAL::can($home_stash, "MODIFY_${svtype}_ATTRIBUTES")
+ if defined $home_stash && $home_stash ne '';
+ my @badattrs;
+ if ($pkgmeth) {
+ my @pkgattrs = _modify_attrs($svref, @attrs);
+ @badattrs = $pkgmeth->($home_stash, $svref, @pkgattrs);
+ if (!@badattrs && @pkgattrs) {
+ require warnings;
+ return unless warnings::enabled('reserved');
+ @pkgattrs = grep { m/\A[[:lower:]]+(?:\z|\()/ } @pkgattrs;
+ if (@pkgattrs) {
+ for my $attr (@pkgattrs) {
+ $attr =~ s/\(.+\z//s;
+ }
+ my $s = ((@pkgattrs == 1) ? '' : 's');
+ carp "$svtype package attribute$s " .
+ "may clash with future reserved word$s: " .
+ join(' : ' , @pkgattrs);
+ }
+ }
+ }
+ else {
+ @badattrs = _modify_attrs($svref, @attrs);
+ }
+ if (@badattrs) {
+ croak "Invalid $svtype attribute" .
+ (( @badattrs == 1 ) ? '' : 's') .
+ ": " .
+ join(' : ', @badattrs);
+ }
+}
+
+sub get ($) {
+ @_ == 1 && ref $_[0] or
+ croak 'Usage: '.__PACKAGE__.'::get $ref';
+ my $svref = shift;
+ my $svtype = uc reftype $svref;
+ my $stash = _guess_stash $svref;
+ $stash = caller unless defined $stash;
+ my $pkgmeth;
+ $pkgmeth = UNIVERSAL::can($stash, "FETCH_${svtype}_ATTRIBUTES")
+ if defined $stash && $stash ne '';
+ return $pkgmeth ?
+ (_fetch_attrs($svref), $pkgmeth->($stash, $svref)) :
+ (_fetch_attrs($svref))
+ ;
+}
+
+sub require_version { goto &UNIVERSAL::VERSION }
+
+1;
+__END__
+#The POD goes here
+
+#line 417
+
Modified: Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon.pm
==============================================================================
--- Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon.pm (original)
+++ Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon.pm Sat Dec 22 10:53:10 2007
@@ -11,7 +11,7 @@
=head1 VERSION
This document describes version 0.65 of Locale::Maketext::Lexicon,
-released July 12, 2007.
+released December 22, 2007.
=head1 SYNOPSIS
@@ -150,6 +150,8 @@
If C<_encoding> is set to C<locale>, the encoding from the
current locale setting is used.
+=back
+
=head2 Subclassing format handlers
If you wish to override how sources specified in different data types
@@ -180,41 +182,47 @@
=cut
our %Opts;
-sub option { shift if ref($_[0]); $Opts{lc $_[0]} }
-sub set_option { shift if ref($_[0]); $Opts{lc $_[0]} = $_[1] }
+sub option { shift if ref( $_[0] ); $Opts{ lc $_[0] } }
+sub set_option { shift if ref( $_[0] ); $Opts{ lc $_[0] } = $_[1] }
sub encoding {
- my $encoding = option(@_, 'encoding') or return;
+ my $encoding = option( @_, 'encoding' ) or return;
return $encoding unless lc($encoding) eq 'locale';
- local $^W; # no warnings 'uninitialized', really.
- my ($country_language, $locale_encoding);
+ local $^W; # no warnings 'uninitialized', really.
+ my ( $country_language, $locale_encoding );
local $@;
eval {
require I18N::Langinfo;
- $locale_encoding = I18N::Langinfo::langinfo(I18N::Langinfo::CODESET());
- } or eval {
+ $locale_encoding =
+ I18N::Langinfo::langinfo( I18N::Langinfo::CODESET() );
+ }
+ or eval {
require Win32::Console;
- $locale_encoding = 'cp'.Win32::Console::OutputCP();
- };
- if (!$locale_encoding) {
+ $locale_encoding = 'cp' . Win32::Console::OutputCP();
+ };
+ if ( !$locale_encoding ) {
foreach my $key (qw( LANGUAGE LC_ALL LC_MESSAGES LANG )) {
$ENV{$key} =~ /^([^.]+)\.([^.:]+)/ or next;
- ($country_language, $locale_encoding) = ($1, $2);
+ ( $country_language, $locale_encoding ) = ( $1, $2 );
last;
}
}
- if (defined $locale_encoding &&
- lc($locale_encoding) eq 'euc' &&
- defined $country_language) {
- if ($country_language =~ /^ja_JP|japan(?:ese)?$/i) {
+ if ( defined $locale_encoding
+ && lc($locale_encoding) eq 'euc'
+ && defined $country_language )
+ {
+ if ( $country_language =~ /^ja_JP|japan(?:ese)?$/i ) {
$locale_encoding = 'euc-jp';
- } elsif ($country_language =~ /^ko_KR|korean?$/i) {
+ }
+ elsif ( $country_language =~ /^ko_KR|korean?$/i ) {
$locale_encoding = 'euc-kr';
- } elsif ($country_language =~ /^zh_CN|chin(?:a|ese)?$/i) {
+ }
+ elsif ( $country_language =~ /^zh_CN|chin(?:a|ese)?$/i ) {
$locale_encoding = 'euc-cn';
- } elsif ($country_language =~ /^zh_TW|taiwan(?:ese)?$/i) {
+ }
+ elsif ( $country_language =~ /^zh_TW|taiwan(?:ese)?$/i ) {
$locale_encoding = 'euc-tw';
}
}
@@ -227,18 +235,19 @@
return unless @_;
my %entries;
- if (UNIVERSAL::isa($_[0], 'HASH')) {
+ if ( UNIVERSAL::isa( $_[0], 'HASH' ) ) {
+
# a hashref with $lang as keys, [$format, $src ...] as values
- %entries = %{$_[0]};
+ %entries = %{ $_[0] };
}
- elsif (@_ % 2 == 0) {
+ elsif ( @_ % 2 == 0 ) {
%entries = ( '' => [ splice @_, 0, 2 ], @_ );
}
# expand the wildcard entry
- if (my $wild_entry = delete $entries{'*'}) {
- while (my ($format, $src) = splice(@$wild_entry, 0, 2)) {
- next if ref($src); # XXX: implement globbing for the 'Tie' backend
+ if ( my $wild_entry = delete $entries{'*'} ) {
+ while ( my ( $format, $src ) = splice( @$wild_entry, 0, 2 ) ) {
+ next if ref($src); # XXX: implement globbing for the 'Tie' backend
my $pattern = quotemeta($src);
$pattern =~ s/\\\*(?=[^*]+$)/\([-\\w]+\)/g or next;
@@ -251,70 +260,73 @@
]eg;
require File::Glob;
- foreach my $file (File::Glob::bsd_glob($src)) {
+ foreach my $file ( File::Glob::bsd_glob($src) ) {
$file =~ /$pattern/ or next;
- push @{$entries{$1}}, ($format => $file) if $1;
+ push @{ $entries{$1} }, ( $format => $file ) if $1;
}
delete $entries{$1}
- unless !defined($1)
- or exists $entries{$1} and @{$entries{$1}};
+ unless !defined($1)
+ or exists $entries{$1} and @{ $entries{$1} };
}
}
%Opts = ();
- foreach my $key (grep /^_/, keys %entries) {
- set_option(lc(substr($key, 1)) => delete($entries{$key}));
+ foreach my $key ( grep /^_/, keys %entries ) {
+ set_option( lc( substr( $key, 1 ) ) => delete( $entries{$key} ) );
}
- my $OptsRef = { %Opts };
+ my $OptsRef = {%Opts};
- while (my ($lang, $entry) = each %entries) {
+ while ( my ( $lang, $entry ) = each %entries ) {
my $export = caller;
- if (length $lang) {
+ if ( length $lang ) {
+
# normalize language tag to Maketext's subclass convention
$lang = lc($lang);
$lang =~ s/-/_/g;
$export .= "::$lang";
}
- my @pairs = @{$entry||[]} or die "no format specified";
+ my @pairs = @{ $entry || [] } or die "no format specified";
- while (my ($format, $src) = splice(@pairs, 0, 2)) {
- if (defined($src) and !ref($src) and $src =~ /\*/) {
- unshift(@pairs, $format => $_) for File::Glob::bsd_glob($src);
+ while ( my ( $format, $src ) = splice( @pairs, 0, 2 ) ) {
+ if ( defined($src) and !ref($src) and $src =~ /\*/ ) {
+ unshift( @pairs, $format => $_ ) for File::Glob::bsd_glob($src);
next;
}
local $@;
- my @content = eval {
- $class->lexicon_get($src, scalar caller, $lang);
- };
+ my @content =
+ eval { $class->lexicon_get( $src, scalar caller, $lang ); };
next if $@ and $@ =~ /^next\b/;
die $@ if $@;
no strict 'refs';
eval "use $class\::$format; 1" or die $@;
- if (defined %{"$export\::Lexicon"}) {
- if (ref(tied %{"$export\::Lexicon"}) eq __PACKAGE__) {
- tied(%{"$export\::Lexicon"})->_force;
+ if ( defined %{"$export\::Lexicon"} ) {
+ if ( ref( tied %{"$export\::Lexicon"} ) eq __PACKAGE__ ) {
+ tied( %{"$export\::Lexicon"} )->_force;
}
+
# clear the memoized cache for old entries:
Locale::Maketext->clear_isa_scan;
+
# be very careful not to pollute the possibly tied lexicon
*{"$export\::Lexicon"} = {
%{"$export\::Lexicon"},
- %{"$class\::$format"->parse(@content)},
+ %{ "$class\::$format"->parse(@content) },
};
}
else {
- local $^W if $] >= 5.009; # no warnings 'once', really.
- tie %{"$export\::Lexicon"}, __PACKAGE__, {
- Opts => $OptsRef,
- Export => "$export\::Lexicon",
- Class => "$class\::$format",
+ local $^W if $] >= 5.009; # no warnings 'once', really.
+ tie %{"$export\::Lexicon"}, __PACKAGE__,
+ {
+ Opts => $OptsRef,
+ Export => "$export\::Lexicon",
+ Class => "$class\::$format",
Content => \@content,
- };
+ };
}
length $lang or next;
@@ -323,10 +335,12 @@
my $caller = caller();
next if $export->isa($caller);
- push(@{"$export\::ISA"}, scalar caller);
+ push( @{"$export\::ISA"}, scalar caller );
- if (my $style = option('style')) {
- my $cref = $class->can(lc("_style_$style"))->( $class, $export->can('maketext') )
+ if ( my $style = option('style') ) {
+ my $cref =
+ $class->can( lc("_style_$style") )
+ ->( $class, $export->can('maketext') )
or die "Unknown style: $style";
# Avoid redefinition warnings
@@ -338,97 +352,106 @@
}
sub _style_gettext {
- my ($self, $orig) = @_;
+ my ( $self, $orig ) = @_;
require Locale::Maketext::Lexicon::Gettext;
sub {
my $lh = shift;
my $str = shift;
- return $orig->($lh, Locale::Maketext::Lexicon::Gettext::_gettext_to_maketext($str), @_);
- }
+ return $orig->(
+ $lh, Locale::Maketext::Lexicon::Gettext::_gettext_to_maketext($str),
+ @_
+ );
+ }
}
sub TIEHASH {
- my ($class, $args) = @_;
- return bless($args, $class);
+ my ( $class, $args ) = @_;
+ return bless( $args, $class );
}
{
no strict 'refs';
+
sub _force {
my $args = shift;
- if (!$args->{Done}++) {
+ if ( !$args->{Done}++ ) {
local *Opts = $args->{Opts};
- *{$args->{Export}} = $args->{Class}->parse(@{$args->{Content}});
- if (option('auto')) {
- (\%{$args->{Export}})->{'_AUTO'} = 1;
+ *{ $args->{Export} } =
+ $args->{Class}->parse( @{ $args->{Content} } );
+ if ( option('auto') ) {
+ ( \%{ $args->{Export} } )->{'_AUTO'} = 1;
}
}
- return \%{$args->{Export}};
+ return \%{ $args->{Export} };
}
- sub FETCH { _force($_[0])->{$_[1]} }
- sub EXISTS { _force($_[0])->{$_[1]} }
- sub DELETE { delete _force($_[0])->{$_[1]} }
- sub SCALAR { scalar %{_force($_[0])} }
- sub STORE { _force($_[0])->{$_[1]} = $_[2] }
- sub CLEAR { %{_force($_[0])->{$_[1]}} = () }
- sub NEXTKEY { each %{_force($_[0])} }
+ sub FETCH { _force( $_[0] )->{ $_[1] } }
+ sub EXISTS { _force( $_[0] )->{ $_[1] } }
+ sub DELETE { delete _force( $_[0] )->{ $_[1] } }
+ sub SCALAR { scalar %{ _force( $_[0] ) } }
+ sub STORE { _force( $_[0] )->{ $_[1] } = $_[2] }
+ sub CLEAR { %{ _force( $_[0] )->{ $_[1] } } = () }
+ sub NEXTKEY { each %{ _force( $_[0] ) } }
+
sub FIRSTKEY {
- my $hash = _force($_[0]);
- my $a = scalar keys %$hash;
+ my $hash = _force( $_[0] );
+ my $a = scalar keys %$hash;
each %$hash;
}
}
sub lexicon_get {
- my ($class, $src, $caller, $lang) = @_;
+ my ( $class, $src, $caller, $lang ) = @_;
return unless defined $src;
- foreach my $type (qw(ARRAY HASH SCALAR GLOB), ref($src)) {
- next unless UNIVERSAL::isa($src, $type);
+ foreach my $type ( qw(ARRAY HASH SCALAR GLOB), ref($src) ) {
+ next unless UNIVERSAL::isa( $src, $type );
my $method = 'lexicon_get_' . lc($type);
die "cannot handle source $type for $src: no $method defined"
- unless $class->can($method);
+ unless $class->can($method);
- return $class->$method($src, $caller, $lang);
+ return $class->$method( $src, $caller, $lang );
}
# default handler
- return $class->lexicon_get_($src, $caller, $lang);
+ return $class->lexicon_get_( $src, $caller, $lang );
}
# for scalarrefs and arrayrefs we just dereference the $src
-sub lexicon_get_scalar { ${$_[1]} }
-sub lexicon_get_array { @{$_[1]} }
+sub lexicon_get_scalar { ${ $_[1] } }
+sub lexicon_get_array { @{ $_[1] } }
-sub lexicon_get_hash {
- my ($class, $src, $caller, $lang) = @_;
+sub lexicon_get_hash {
+ my ( $class, $src, $caller, $lang ) = @_;
return map { $_ => $src->{$_} } sort keys %$src;
}
-sub lexicon_get_glob {
- my ($class, $src, $caller, $lang) = @_;
+sub lexicon_get_glob {
+ my ( $class, $src, $caller, $lang ) = @_;
no strict 'refs';
- local $^W if $] >= 5.009; # no warnings 'once', really.
+ local $^W if $] >= 5.009; # no warnings 'once', really.
# be extra magical and check for DATA section
- if (eof($src) and $src eq \*{"$caller\::DATA"} or $src eq \*{"main\::DATA"}) {
+ if ( eof($src) and $src eq \*{"$caller\::DATA"}
+ or $src eq \*{"main\::DATA"} )
+ {
+
# okay, the *DATA isn't initiated yet. let's read.
#
require FileHandle;
my $fh = FileHandle->new;
- my $package = ( ($src eq \*{"main\::DATA"}) ? 'main' : $caller );
+ my $package = ( ( $src eq \*{"main\::DATA"} ) ? 'main' : $caller );
if ( $package eq 'main' and -e $0 ) {
$fh->open($0) or die "Can't open $0: $!";
}
else {
my $level = 1;
- while ( my ($pkg, $filename) = caller($level++) ) {
+ while ( my ( $pkg, $filename ) = caller( $level++ ) ) {
next unless $pkg eq $package;
next unless -e $filename;
next;
@@ -439,6 +462,7 @@
}
while (<$fh>) {
+
# okay, this isn't foolproof, but good enough
last if /^__DATA__$/;
}
@@ -447,27 +471,30 @@
}
# fh containing the lines
- my $pos = tell($src);
+ my $pos = tell($src);
my @lines = <$src>;
- seek($src, $pos, 0);
+ seek( $src, $pos, 0 );
return @lines;
}
# assume filename - search path, open and return its contents
sub lexicon_get_ {
- my ($class, $src, $caller, $lang) = @_;
+ my ( $class, $src, $caller, $lang ) = @_;
require FileHandle;
require File::Spec;
my $fh = FileHandle->new;
- my @path = split('::', $caller);
+ my @path = split( '::', $caller );
push @path, $lang if length $lang;
- $src = (grep { -e } map {
- my @subpath = @path[0..$_];
- map { File::Spec->catfile($_, @subpath, $src) } @INC;
- } -1 .. $#path)[-1] unless -e $src;
+ $src = (
+ grep { -e } map {
+ my @subpath = @path[ 0 .. $_ ];
+ map { File::Spec->catfile( $_, @subpath, $src ) } @INC;
+ } -1 .. $#path
+ )[-1]
+ unless -e $src;
defined $src or die 'next';
Modified: Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Auto.pm
==============================================================================
--- Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Auto.pm (original)
+++ Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Auto.pm Sat Dec 22 10:53:10 2007
@@ -1,5 +1,5 @@
package Locale::Maketext::Lexicon::Auto;
-$Locale::Maketext::Lexicon::Auto::VERSION = '0.03';
+$Locale::Maketext::Lexicon::Auto::VERSION = '0.04';
use strict;
@@ -47,25 +47,30 @@
Audrey Tang E<lt>cpan at audreyt.orgE<gt>
-=head1 COPYRIGHT (The "MIT" License)
+=head1 COPYRIGHT
-Copyright 2002, 2003, 2004 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+Copyright 2002, 2003, 2004, 2007 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+
+This software is released under the MIT license cited below.
+
+=head2 The "MIT" License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is fur-
-nished to do so, subject to the following conditions:
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
-NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
=cut
Modified: Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Gettext.pm
==============================================================================
--- Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Gettext.pm (original)
+++ Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Gettext.pm Sat Dec 22 10:53:10 2007
@@ -1,5 +1,5 @@
package Locale::Maketext::Lexicon::Gettext;
-$Locale::Maketext::Lexicon::Gettext::VERSION = '0.15';
+$Locale::Maketext::Lexicon::Gettext::VERSION = '0.16';
use strict;
@@ -87,8 +87,8 @@
my ($InputEncoding, $OutputEncoding, $DoEncoding);
-sub input_encoding { $InputEncoding };
-sub output_encoding { $OutputEncoding };
+sub input_encoding { $InputEncoding }
+sub output_encoding { $OutputEncoding }
sub parse {
my $self = shift;
@@ -102,77 +102,94 @@
# Check for magic string of MO files
return parse_mo(join('', @_))
- if ($_[0] =~ /^\x95\x04\x12\xde/ or $_[0] =~ /^\xde\x12\x04\x95/);
+ if ($_[0] =~ /^\x95\x04\x12\xde/ or $_[0] =~ /^\xde\x12\x04\x95/);
- local $^W; # no 'uninitialized' warnings, please.
+ local $^W; # no 'uninitialized' warnings, please.
require Locale::Maketext::Lexicon;
- my $UseFuzzy = Locale::Maketext::Lexicon::option('use_fuzzy');
+ my $UseFuzzy = Locale::Maketext::Lexicon::option('use_fuzzy');
my $AllowEmpty = Locale::Maketext::Lexicon::option('allow_empty');
- my $process = sub {
- if ( length($var{msgstr}) and ($UseFuzzy or !$var{fuzzy}) ) {
- push @ret, (map transform($_), @var{'msgid', 'msgstr'});
- }
- elsif ( $AllowEmpty ) {
- push @ret, (transform($var{msgid}), '');
- }
- push @metadata, parse_metadata($var{msgstr})
- if $var{msgid} eq '';
- %var = ();
+ my $process = sub {
+ if (length($var{msgstr}) and ($UseFuzzy or !$var{fuzzy})) {
+ push @ret, (map transform($_), @var{ 'msgid', 'msgstr' });
+ }
+ elsif ($AllowEmpty) {
+ push @ret, (transform($var{msgid}), '');
+ }
+ push @metadata, parse_metadata($var{msgstr})
+ if $var{msgid} eq '';
+ %var = ();
};
# Parse PO files
foreach (@_) {
- s/[\015\012]*\z//; # fix CRLF issues
+ s/[\015\012]*\z//; # fix CRLF issues
- /^(msgid|msgstr) +"(.*)" *$/ ? do { # leading strings
+ /^(msgid|msgstr) +"(.*)" *$/
+ ? do { # leading strings
$var{$1} = $2;
$key = $1;
- } :
+ }
+ :
- /^"(.*)" *$/ ? do { # continued strings
+ /^"(.*)" *$/
+ ? do { # continued strings
$var{$key} .= $1;
- } :
+ }
+ :
- /^#, +(.*) *$/ ? do { # control variables
+ /^#, +(.*) *$/
+ ? do { # control variables
$var{$_} = 1 for split(/,\s+/, $1);
- } :
+ }
+ :
- /^ *$/ && %var ? do { # interpolate string escapes
- $process->($_);
- } : ();
+ /^ *$/ && %var
+ ? do { # interpolate string escapes
+ $process->($_);
+ }
+ : ();
}
+
# do not silently skip last entry
$process->() if keys %var != 0;
- push @ret, map { transform($_) } @var{'msgid', 'msgstr'}
- if length $var{msgstr};
+ push @ret, map { transform($_) } @var{ 'msgid', 'msgstr' }
+ if length $var{msgstr};
push @metadata, parse_metadata($var{msgstr})
- if $var{msgid} eq '';
+ if $var{msgid} eq '';
- return {@metadata, @ret};
+ return { @metadata, @ret };
}
sub parse_metadata {
return map {
- (/^([^\x00-\x1f\x80-\xff :=]+):\s*(.*)$/) ?
- ($1 eq 'Content-Type') ? do {
- my $enc = $2;
- if ($enc =~ /\bcharset=\s*([-\w]+)/i) {
- $InputEncoding = $1 || '';
- $OutputEncoding = Locale::Maketext::Lexicon::encoding() || '';
- $InputEncoding = 'utf8' if $InputEncoding =~ /^utf-?8$/i;
- $OutputEncoding = 'utf8' if $OutputEncoding =~ /^utf-?8$/i;
- if ( Locale::Maketext::Lexicon::option('decode') and
- (!$OutputEncoding or $InputEncoding ne $OutputEncoding)) {
- require Encode::compat if $] < 5.007001;
- require Encode;
- $DoEncoding = 1;
- }
- }
- ("__Content-Type", $enc);
- } : ("__$1", $2)
- : ();
+ (/^([^\x00-\x1f\x80-\xff :=]+):\s*(.*)$/)
+ ? ($1 eq 'Content-Type')
+ ? do {
+ my $enc = $2;
+ if ($enc =~ /\bcharset=\s*([-\w]+)/i) {
+ $InputEncoding = $1 || '';
+ $OutputEncoding = Locale::Maketext::Lexicon::encoding()
+ || '';
+ $InputEncoding = 'utf8' if $InputEncoding =~ /^utf-?8$/i;
+ $OutputEncoding = 'utf8'
+ if $OutputEncoding =~ /^utf-?8$/i;
+ if (
+ Locale::Maketext::Lexicon::option('decode')
+ and ( !$OutputEncoding
+ or $InputEncoding ne $OutputEncoding)
+ )
+ {
+ require Encode::compat if $] < 5.007001;
+ require Encode;
+ $DoEncoding = 1;
+ }
+ }
+ ("__Content-Type", $enc);
+ }
+ : ("__$1", $2)
+ : ();
} split(/\r*\n+\r*/, transform(pop));
}
@@ -180,17 +197,19 @@
my $str = shift;
if ($DoEncoding and $InputEncoding) {
- $str = ($InputEncoding eq 'utf8')
- ? Encode::decode_utf8($str)
- : Encode::decode($InputEncoding, $str)
+ $str =
+ ($InputEncoding eq 'utf8')
+ ? Encode::decode_utf8($str)
+ : Encode::decode($InputEncoding, $str);
}
$str =~ s/\\([0x]..|c?.)/qq{"\\$1"}/eeg;
if ($DoEncoding and $OutputEncoding) {
- $str = ($OutputEncoding eq 'utf8')
- ? Encode::encode_utf8($str)
- : Encode::encode($OutputEncoding, $str)
+ $str =
+ ($OutputEncoding eq 'utf8')
+ ? Encode::encode_utf8($str)
+ : Encode::encode($OutputEncoding, $str);
}
return _gettext_to_maketext($str);
@@ -217,9 +236,9 @@
}
sub _unescape {
- join(',', map {
- /\A(\s*)%([1-9]\d*|\*)(\s*)\z/ ? "$1_$2$3" : $_
- } split(/,/, $_[0]));
+ join(',',
+ map { /\A(\s*)%([1-9]\d*|\*)(\s*)\z/ ? "$1_$2$3" : $_ }
+ split(/,/, $_[0]));
}
# This subroutine was derived from Locale::Maketext::Gettext::readmo()
@@ -233,27 +252,35 @@
return if unpack($tmpl, substr($content, 4, 4)) > 0;
my ($num, $offo, $offt);
+
# Number of strings
$num = unpack $tmpl, substr($content, 8, 4);
+
# Offset to the beginning of the original strings
$offo = unpack $tmpl, substr($content, 12, 4);
+
# Offset to the beginning of the translated strings
$offt = unpack $tmpl, substr($content, 16, 4);
my (@metadata, @ret);
for (0 .. $num - 1) {
my ($len, $off, $stro, $strt);
+
# The first word is the length of the string
- $len = unpack $tmpl, substr($content, $offo+$_*8, 4);
+ $len = unpack $tmpl, substr($content, $offo + $_ * 8, 4);
+
# The second word is the offset of the string
- $off = unpack $tmpl, substr($content, $offo+$_*8+4, 4);
+ $off = unpack $tmpl, substr($content, $offo + $_ * 8 + 4, 4);
+
# Original string
$stro = substr($content, $off, $len);
# The first word is the length of the string
- $len = unpack $tmpl, substr($content, $offt+$_*8, 4);
+ $len = unpack $tmpl, substr($content, $offt + $_ * 8, 4);
+
# The second word is the offset of the string
- $off = unpack $tmpl, substr($content, $offt+$_*8+4, 4);
+ $off = unpack $tmpl, substr($content, $offt + $_ * 8 + 4, 4);
+
# Translated string
$strt = substr($content, $off, $len);
@@ -262,7 +289,7 @@
push @ret, (map transform($_), $stro, $strt) if length $strt;
}
- return {@metadata, @ret};
+ return { @metadata, @ret };
}
1;
@@ -275,25 +302,30 @@
Audrey Tang E<lt>cpan at audreyt.orgE<gt>
-=head1 COPYRIGHT (The "MIT" License)
+=head1 COPYRIGHT
+
+Copyright 2002, 2003, 2004, 2007 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+
+This software is released under the MIT license cited below.
-Copyright 2002, 2003, 2004 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+=head2 The "MIT" License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is fur-
-nished to do so, subject to the following conditions:
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
-NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
=cut
Modified: Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Msgcat.pm
==============================================================================
--- Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Msgcat.pm (original)
+++ Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Msgcat.pm Sat Dec 22 10:53:10 2007
@@ -38,31 +38,38 @@
sub parse {
my $set = 0;
my $msg = undef;
- my ($qr, $qq, $qc) = (qr//, '', '');
+ my ($qr, $qq, $qc) = (qr//, '', '');
my @out;
# Set up the msgcat handler
- { no strict 'refs';
- *{Locale::Maketext::msgcat} = \&_msgcat; }
+ {
+ no strict 'refs';
+ *{Locale::Maketext::msgcat} = \&_msgcat;
+ }
# Parse *.m files; Locale::Msgcat objects and *.cat are not yet supported.
foreach (@_) {
- s/[\015\012]*\z//; # fix CRLF issues
+ s/[\015\012]*\z//; # fix CRLF issues
- /^\$set (\d+)/ ? do { # set_id
+ /^\$set (\d+)/
+ ? do { # set_id
$set = int($1);
push @out, $1, "[msgcat,$1,_1]";
- } :
+ }
+ :
- /^\$quote (.)/ ? do { # quote character
+ /^\$quote (.)/
+ ? do { # quote character
$qc = $1;
$qq = quotemeta($1);
$qr = qr/$qq?/;
- } :
+ }
+ :
- /^(\d+) ($qr)(.*?)\2(\\?)$/ ? do { # msg_id and msg_str
+ /^(\d+) ($qr)(.*?)\2(\\?)$/
+ ? do { # msg_id and msg_str
local $^W;
- push @out, "$set,".int($1);
+ push @out, "$set," . int($1);
if ($4) {
$msg = $3;
}
@@ -70,9 +77,11 @@
push @out, unescape($qq, $qc, $3);
undef $msg;
}
- } :
+ }
+ :
- (defined $msg and /^($qr)(.*?)\1(\\?)$/) ? do { # continued string
+ (defined $msg and /^($qr)(.*?)\1(\\?)$/)
+ ? do { # continued string
local $^W;
if ($3) {
$msg .= $2;
@@ -81,17 +90,18 @@
push @out, unescape($qq, $qc, $msg . $2);
undef $msg;
}
- } : ();
+ }
+ : ();
}
push @out, '' if defined $msg;
- return { @out };
+ return {@out};
}
sub _msgcat {
my ($self, $set_id, $msg_id, @args) = @_;
- return $self->maketext(int($set_id).','.int($msg_id), @args)
+ return $self->maketext(int($set_id) . ',' . int($msg_id), @args);
}
sub unescape {
@@ -111,25 +121,30 @@
Audrey Tang E<lt>cpan at audreyt.orgE<gt>
-=head1 COPYRIGHT (The "MIT" License)
+=head1 COPYRIGHT
+
+Copyright 2002, 2003, 2004, 2007 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+
+This software is released under the MIT license cited below.
-Copyright 2002, 2003, 2004 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+=head2 The "MIT" License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is fur-
-nished to do so, subject to the following conditions:
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
-NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
=cut
Modified: Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Tie.pm
==============================================================================
--- Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Tie.pm (original)
+++ Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon/Tie.pm Sat Dec 22 10:53:10 2007
@@ -38,7 +38,7 @@
eval "use $mod; 1" or die $@ unless defined %{"$mod\::"};
}
- # Perform the actual tie
+ # Perform the actual tie
tie %{*$sym}, $mod, @_;
# Returns the GLOB reference, so %Lexicon will be tied too
@@ -55,25 +55,30 @@
Audrey Tang E<lt>cpan at audreyt.orgE<gt>
-=head1 COPYRIGHT (The "MIT" License)
+=head1 COPYRIGHT
-Copyright 2002, 2003, 2004 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+Copyright 2002, 2003, 2004, 2007 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+
+This software is released under the MIT license cited below.
+
+=head2 The "MIT" License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is fur-
-nished to do so, subject to the following conditions:
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
-NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
=cut
Modified: Locale-Maketext-Lexicon/script/xgettext.pl
==============================================================================
--- Locale-Maketext-Lexicon/script/xgettext.pl (original)
+++ Locale-Maketext-Lexicon/script/xgettext.pl Sat Dec 22 10:53:10 2007
@@ -44,12 +44,16 @@
=head2 Input file format:
+=over 4
+
=item B<-u>, B<--use-gettext-style>
Specifies that the source programs uses the B<Gettext> style (e.g.
C<%1>) instead of the B<Maketext> style (e.g. C<[_1]>) in its
localization calls.
+=back
+
=head2 Output file location:
=over 4
More information about the Bps-public-commit
mailing list