richter 2005/01/16 22:24:40
Modified: . Changes.pod embpmsgid.pl.templ eputil.c
Embperl/Syntax MsgIdExtract.pm
test testapp.pl
test/cmp i18n.htm
test/html/app i18n.htm
Log:
- Fix [= =] with included spaces in embpmsgid.pl. Reported by Robert.
- Make undef values for translation hashs treat as the same as
non exists. Requested by Robert.
- Let embpmsgid.pl parse out language tags of gettext, sort output
and don't convert chars > 128 to octal values. Requested by Robert.
Revision Changes Path
1.259 +5 -1 embperl/Changes.pod
Index: Changes.pod
===================================================================
RCS file: /home/cvs/embperl/Changes.pod,v
retrieving revision 1.258
retrieving revision 1.259
diff -u -r1.258 -r1.259
--- Changes.pod 15 Jan 2005 20:17:26 -0000 1.258
+++ Changes.pod 17 Jan 2005 06:24:40 -0000 1.259
@@ -9,7 +9,11 @@
- Applied patches from Angus Lees to make Embperl compile and test on
64Bit machines and avoid some compiler warnings.
- Add pod for embpmsgid.pl from Angus Lees.
-
+ - Fix [= =] with included spaces in embpmsgid.pl. Reported by Robert.
+ - Make undef values for translation hashs treat as the same as
+ non exists. Requested by Robert.
+ - Let embpmsgid.pl parse out language tags of gettext, sort output
+ and don't convert chars > 128 to octal values. Requested by Robert.
=head1 2.0rc2 21. November 2004
1.4 +51 -2 embperl/embpmsgid.pl.templ
Index: embpmsgid.pl.templ
===================================================================
RCS file: /home/cvs/embperl/embpmsgid.pl.templ,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- embpmsgid.pl.templ 23 Jan 2004 06:50:54 -0000 1.3
+++ embpmsgid.pl.templ 17 Jan 2005 06:24:40 -0000 1.4
@@ -113,6 +113,7 @@
}
+$Data::Dumper::Sortkeys = \&{ sub {[ sort { $a cmp $b } keys %{$_[0]} ]} } ;
print Data::Dumper -> Dump ([\%Embperl::Syntax::MsgIdExtract::Ids],
['msgids']) ;
@@ -134,13 +135,61 @@
rename $opt_datadumper, "$opt_datadumper.bak" ;
open FH, ">$opt_datadumper" or die "Cannot open $opt_datadumper
($!)" ;
$Data::Dumper::Indent = 1 ;
- $Data::Dumper::Useqq = 1 ;
+ #$Data::Dumper::Useqq = 1 ;
print FH Data::Dumper -> Dump ([$msgids], ['msgids']) ;
close FH ;
}
}
+__END__
+
+=head1 NAME
+
+embpmsgid.pl - Extract message ids from Embperl files
+
+=head1 SYNOPSIS
+
+embpmsgid.pl [I<options>] [I<files>]
+
+=head1 DESCRIPTION
+
+Extract message ids (C<[= ... =]> blocks) from Embperl files given on
+command line.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--datadumper>=I<file>, B<-d>
+
+Use the given file to read and store message ids. Must be valid Perl
+code which defines $msgids.
+
+=item B<--dbm>=I<file>, B<-b>
+
+Use the given file to read and store message ids. Must be a dbm file.
+
+=item B<--languages>=I<code>, B<-l>
+
+Specify language code to generate. Can be given multiple times.
+
+=back
+
+=head1 SEE ALSO
+
+L<Embperl>
+
+=head1 AUTHOR
+
+G. Richter ([EMAIL PROTECTED])
+
+=end
+
+
+
+
+
1.43 +6 -4 embperl/eputil.c
Index: eputil.c
===================================================================
RCS file: /home/cvs/embperl/eputil.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- eputil.c 16 Aug 2004 07:36:18 -0000 1.42
+++ eputil.c 17 Jan 2005 06:24:40 -0000 1.43
@@ -1788,7 +1788,8 @@
epTHX_
IV len ;
IV i ;
- char * pMsg ;
+ SV ** ppSV ;
+ STRLEN l ;
if (!arr || SvTYPE(arr) != SVt_PVAV)
return NULL ;
@@ -1803,8 +1804,9 @@
if (SvTYPE (pHV) != SVt_PVHV)
continue ;
- if ((pMsg = GetHashValueStr (aTHX_ pHV, sMsgId, NULL)))
- return pMsg ;
+ ppSV = hv_fetch(pHV, (char *)sMsgId, strlen (sMsgId), 0) ;
+ if (ppSV != NULL)
+ return SvOK(*ppSV)?SvPV (*ppSV, l):NULL ;
}
}
return NULL ;
1.5 +36 -13 embperl/Embperl/Syntax/MsgIdExtract.pm
Index: MsgIdExtract.pm
===================================================================
RCS file: /home/cvs/embperl/Embperl/Syntax/MsgIdExtract.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MsgIdExtract.pm 16 Jan 2005 13:31:14 -0000 1.4
+++ MsgIdExtract.pm 17 Jan 2005 06:24:40 -0000 1.5
@@ -81,6 +81,7 @@
'text' => '[=',
'end' => '=]',
'unescape' => 1,
+ removespaces => 72,
'procinfo' => {
embperl => {
perlcode =>
@@ -89,7 +90,6 @@
],
removenode => 4,
compilechilds => 0,
- removespaces => 12
}
},
},
@@ -98,20 +98,43 @@
'end' => ')',
'unescape' => 1,
follow => {
- 'string' =>
+ 'bracktes' =>
{
- 'text' => '(\'',
+ 'text' => '(',
'end' => ')',
- 'procinfo' => {
- embperl => {
- perlcode =>
- [
- '$Embperl::Syntax::MsgIdExtract::Ids{%#\'0%}
= q{} if (!exists ($Embperl::Syntax::MsgIdExtract::Ids{%#\'0%})) ;',
- ],
- removenode => 4,
- compilechilds => 0,
- removespaces => 12
- }
+ follow => {
+ 'Quote ""' =>
+ {
+ 'text' => '"',
+ 'end' => '"',
+ removespaces => 72,
+ 'procinfo' => {
+ embperl => {
+ perlcode =>
+ [
+
'$Embperl::Syntax::MsgIdExtract::Ids{%#\'0%} = q{} if (!exists
($Embperl::Syntax::MsgIdExtract::Ids{%#\'0%})) ;',
+ ],
+ removenode => 4,
+ compilechilds => 0,
+ }
+ },
+ },
+ 'Quote \'\'' =>
+ {
+ 'text' => '\'',
+ 'end' => '\'',
+ removespaces => 72,
+ 'procinfo' => {
+ embperl => {
+ perlcode =>
+ [
+
'$Embperl::Syntax::MsgIdExtract::Ids{%#\'0%} = q{} if (!exists
($Embperl::Syntax::MsgIdExtract::Ids{%#\'0%})) ;',
+ ],
+ removenode => 4,
+ compilechilds => 0,
+ }
+ },
+ },
},
},
},
1.4 +2 -0 embperl/test/testapp.pl
Index: testapp.pl
===================================================================
RCS file: /home/cvs/embperl/test/testapp.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- testapp.pl 26 Nov 2002 10:03:45 -0000 1.3
+++ testapp.pl 17 Jan 2005 06:24:40 -0000 1.4
@@ -17,6 +17,7 @@
'url' => 'URL',
'show2' => 'Folgender Eintrag wurde erfolgreich der Datenbank
hinzugef�gt',
'last' => 'last zwischen [= =]',
+ 'test undef' => undef,
},
'en' =>
{
@@ -30,6 +31,7 @@
'url' => 'URL',
'show2' => 'The following entry has been sucessfully added to the
database',
'last' => 'last inside of [= =]',
+ 'test undef' => undef,
},
) ;
1.4 +3 -0 embperl/test/cmp/i18n.htm
Index: i18n.htm
===================================================================
RCS file: /home/cvs/embperl/test/cmp/i18n.htm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- i18n.htm 26 Nov 2002 10:03:45 -0000 1.3
+++ i18n.htm 17 Jan 2005 06:24:40 -0000 1.4
@@ -124,3 +124,6 @@
last zwischen [= =]<br>
+this is text with spaces
+ÄÜÖ
+test undef
\ No newline at end of file
1.4 +4 -0 embperl/test/html/app/i18n.htm
Index: i18n.htm
===================================================================
RCS file: /home/cvs/embperl/test/html/app/i18n.htm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- i18n.htm 26 Nov 2002 10:03:45 -0000 1.3
+++ i18n.htm 17 Jan 2005 06:24:40 -0000 1.4
@@ -86,6 +86,10 @@
[$endforeach$]
+[= this is text with spaces =]
+[+ $r -> gettext('���') +]
+
+[= test undef =]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]