[Po4a-devel]$BFCJL4k2h!*0lK|1_J,;H$$J|Bj(B?
by info@kqsv12.com
$BK\F|!"?75,EPO?$N$*5RMM$K8B$j0lK|1_J,;H$$J|Bj$N%3!<%9$r@_$1$^$7$?(B
http://www.awg4.com/?chance12
$B"-"-"d$*CN$i$;"c"-"-(B
$B"((B($B2hA|(B)$B!!(B($BF02h(B)$B!!(B($BD>EE(B)$B!!(B($BD>%a(B)$B$r<+M3$K8r49=PMh$^$9(B
$B"($"$k$*5RMM$O(BFREE$B$G$N%A%c%C%H$b8D!9$G3Z$7$s$G$$$k8+$?$$$G$9$M!*(B
$B!J0lBP0lKt$OJ#?t$NJ}$H$N%A%c%C%H!K(B
$B"(CK=wHfN("M(B4$B!'(B6$B$H=w@-2q0w$,B??t2q0w$H$J$C$F$*$j$^$9!#(B
$B"-@'Hs!"GA$$$F$M!*"-(B
http://www.awg4.com/?chance12
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
$B<u?.5qH]$O(Bawg_kanri2004(a)ok.kz
18$B:PL$K~6X;_(B
19 years, 5 months
[Po4a-devel][ #300874 ] Included files should be searched in the path of the master
by Francois Gouget
I hit this problem with winedoc because the source English documentation
is in the 'en' subdirectory while the French po files are in the 'fr'
subdirectory.
The way I initially worked around it is by doing the following:
SGMLDIR = $(TOPSRCDIR)/en
DOCDIR = $(TOPSRCDIR)/fr
%.posgml: $(SGMLDIR)/%.sgml %.po
cd $(SGMLDIR) && $(PO4AENV) perl $(PO4ADIR)/po4a-translate -v -f
sgml -m $*.sgml -p $(DOCDIR)/$*.po -l $(DOCDIR)/$*.posgml -k $(MIN_TRANS)
But this does not work for out-of-tree builds because then $(DOCDIR) is
wrong.
So I checked what the standard DocBook tools think about the inclusion
of files. It turns out that 'docbook2html -u ../en/wineusr-guide.sgml'
works just fine despite the fact that 'wineusr-guide.sgml' includes
other Sgml files via relative paths.
So this seems to give credence to the claim that the path of included
files should be interpreted as being relative to the master Sgml file.
So here's a patch which does just that and I think this fixes bug #300874.
This makes it possible to rewrite the above as the following which works
for out-oftree builds too:
SGMLDIR = $(TOPSRCDIR)/en
%.posgml: $(SGMLDIR)/%.sgml %.po
$(PO4AENV) perl $(PO4ADIR)/po4a-translate -v -f sgml -m
$(SGMLDIR)/$*.sgml -p $(SRCDIR)/$*.po -l $*.posgml -k $(MIN_TRANS)
Changelog:
* lib/Locale/Po4a/Sgml.pm
Francois Gouget <fgouget(a)codeweavers.com>
If relative, the path of included file must be considered to be
relative to the path of the master Sgml file.
Fixes bug #300874.
--
Francois Gouget
fgouget(a)codeweavers.com
Index: lib/Locale/Po4a/Sgml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v
retrieving revision 1.55
diff -u -p -r1.55 Sgml.pm
--- lib/Locale/Po4a/Sgml.pm 21 May 2005 18:42:21 -0000 1.55
+++ lib/Locale/Po4a/Sgml.pm 24 May 2005 11:47:01 -0000
@@ -290,24 +290,24 @@ sub set_tags_kind {
# Do the actual work, using the SGMLS package and settings done elsewhere.
#
sub parse_file {
- my ($self,$filename)=@_;
+ my ($self,$mastername)=@_;
my ($prolog);
# Rewrite the file to:
# - protect optional inclusion marker (ie, "<![ %str [" and "]]>")
# - protect entities from expansion (ie "&release;")
- open (IN,"<$filename")
- || die wrap_mod("po4a::sgml", dgettext("po4a", "Can't open %s: %s"), $filename, $!);
+ open (IN,"<$mastername")
+ || die wrap_mod("po4a::sgml", dgettext("po4a", "Can't open %s: %s"), $mastername, $!);
my $origfile="";
while (<IN>) {
$origfile .= $_;
}
- close IN || die wrap_mod("po4a::sgml", dgettext("po4a", "Can't close %s: %s"), $filename, $!);
+ close IN || die wrap_mod("po4a::sgml", dgettext("po4a", "Can't close %s: %s"), $mastername, $!);
# Detect the XML pre-prolog
if ($origfile =~ s/^(\s*<\?xml[^?]*\?>)//) {
warn wrap_mod("po4a::sgml", dgettext("po4a",
"Trying to handle a XML document as a SGML one. ".
- "Feel lucky if it works, help us implementing a proper XML backend if it does not."), $filename)
+ "Feel lucky if it works, help us implementing a proper XML backend if it does not."), $mastername)
unless $self->verbose() <= 0;
$xmlprolog=$1;
}
@@ -443,8 +443,8 @@ sub parse_file {
my @lines = split(/\n/, $origfile);
print "XX Prepare reference indirection stuff\n" if $debug{'refs'};
for (my $i=1; $i<=scalar @lines; $i++) {
- push @refs,"$filename:$i";
- print "$filename:$i\n" if $debug{'refs'};
+ push @refs,"$mastername:$i";
+ print "$mastername:$i\n" if $debug{'refs'};
}
# protect the conditional inclusions in the file
@@ -478,6 +478,12 @@ sub parse_file {
my $key = $2;
my $filename=$3;
$prolog = $1.$4;
+ if ($filename !~ m%/%)
+ {
+ my $dir=$mastername;
+ $dir =~ s%/[^/]*$%%;
+ $filename="$dir/$filename";
+ }
(-e $filename && open IN,"<$filename") ||
die wrap_mod("po4a::sgml", dgettext("po4a", "Can't open %s (content of entity %s%s;): %s"),
$filename, '%', $key, $!);
@@ -530,6 +536,12 @@ sub parse_file {
my $key = $2;
my $filename = $3;
$searchprolog = $1.$4;
+ if ($filename !~ m%/%)
+ {
+ my $dir=$mastername;
+ $dir =~ s%/[^/]*$%%;
+ $filename="$dir/$filename";
+ }
$entincl{$key}{'filename'}=$filename;
# Preload the content of the entity
(-e $filename && open IN,"<$filename") ||
@@ -588,7 +600,7 @@ sub parse_file {
if ($debug{'refs'}) {
print "XX Resulting shifts\n";
for (my $i=0; $i<scalar @refs; $i++) {
- print "$filename:".($i+1)." -> $refs[$i]\n";
+ print "$mastername:".($i+1)." -> $refs[$i]\n";
}
}
19 years, 5 months
[Po4a-devel]Sgml.pm: Fix handling of the debug option
by Francois Gouget
(Resending because I was not subscribed from this email address. I
apologize for the inconvenience if it gets in twice)
Sgml.pm's debug option is a space separated list of 'channels' to print
debug information for. But its value was not being split which caused
the option not to work.
Changelog:
* lib/Locale/Po4a/Sgml.pm
Francois Gouget <fgouget(a)codeweavers.com>
The debug option is a space separated list of channels to print
information for. So we must
split it to set $debug.
--
Francois Gouget
fgouget(a)codeweavers.com
Index: lib/Locale/Po4a/Sgml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v
retrieving revision 1.55
diff -u -p -r1.55 Sgml.pm
--- lib/Locale/Po4a/Sgml.pm 21 May 2005 18:42:21 -0000 1.55
+++ lib/Locale/Po4a/Sgml.pm 24 May 2005 11:47:01 -0000
@@ -217,7 +217,7 @@ sub initialize {
}
}
if ($options{'debug'}) {
- foreach ($options{'debug'}) {
+ foreach (split /\s+/, $options{'debug'}) {
$debug{$_} = 1;
}
}
19 years, 5 months
[Po4a-devel]Try to clarify --option's documentation
by Francois Gouget
Reading the documentation/man pages, it was not very clear to me how to
use the '--option' command line option. Especially:
* how does one pass more than one option?
(answer: use '--option' more than once)
* how do you specify the option name and its value
(answer: use 'name=value' for each option)
It turns out it works in a pretty standard and reasonable way but it
seemed worth trying to clarify the documentation so I would not have to
read the source code next time around. Hopefully I succeeded in making
things clearer. If not let me know, I'm open to suggestions.
Changelog:
* po4a-gettextize
po4a-normalize
po4a-translate
po4a-updatepo
Francois Gouget <fgouget(a)codeweavers.com>
Clarify the '--option' documentation.
--
Francois Gouget
fgouget(a)codeweavers.com
Index: po4a-gettextize
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-gettextize,v
retrieving revision 1.30
diff -u -p -r1.30 po4a-gettextize
--- po4a-gettextize 4 Mar 2005 16:40:40 -0000 1.30
+++ po4a-gettextize 24 May 2005 11:47:00 -0000
@@ -88,8 +88,9 @@ catalog will be written to the standard
=item -o, --option
-Pass an extra option to the format plugin. See the documentation of each
-plugin for more information about the valid options and their meanings.
+Extra option(s) to pass to the format plugin. Specify each option in the
+'name=value' format. See the documentation of each plugin for more
+information about the valid options and their meanings.
=item -h, --help
Index: po4a-normalize
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-normalize,v
retrieving revision 1.24
diff -u -p -r1.24 po4a-normalize
--- po4a-normalize 4 Mar 2005 16:40:40 -0000 1.24
+++ po4a-normalize 24 May 2005 11:47:00 -0000
@@ -40,8 +40,9 @@ that ;)
=item -o, --option
-Pass an extra option to the format plugin. See the documentation of each
-plugin for more information about the valid options and their meanings.
+Extra option(s) to pass to the format plugin. Specify each option in the
+'name=value' format. See the documentation of each plugin for more
+information about the valid options and their meanings.
=item -h, --help
Index: po4a-translate
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-translate,v
retrieving revision 1.36
diff -u -p -r1.36 po4a-translate
--- po4a-translate 4 Mar 2005 16:40:40 -0000 1.36
+++ po4a-translate 24 May 2005 11:47:00 -0000
@@ -76,8 +76,9 @@ File from which the message catalog shou
=item -o, --option
-Pass an extra option to the format plugin. See the documentation of each
-plugin for more information about the valid options and their meanings.
+Extra option(s) to pass to the format plugin. Specify each option in the
+'name=value' format. See the documentation of each plugin for more
+information about the valid options and their meanings.
=item -k, --keep
Index: po4a-updatepo
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-updatepo,v
retrieving revision 1.33
diff -u -p -r1.33 po4a-updatepo
--- po4a-updatepo 4 Mar 2005 16:40:41 -0000 1.33
+++ po4a-updatepo 24 May 2005 11:47:00 -0000
@@ -66,8 +66,9 @@ C<po4a-updatepo>.
=item -o, --option
-Pass an extra option to the format plugin. See the documentation of each
-plugin for more information about the valid options and their meanings.
+Extra option(s) to pass to the format plugin. Specify each option in the
+'name=value' format. See the documentation of each plugin for more
+information about the valid options and their meanings.
=item -h, --help
19 years, 5 months
[Po4a-devel]Fix error reporting bug in Chooser.pm
by Francois Gouget
When Chooser.pm fails to load a plugin all it prints is:
Module loading error:
That is, it does not print the reason why it failed to load the plugin.
The reason for this is that '$@' gets clobbered at some time between the
error and when if finally gets printed. Storing it in an intermediate
variable solves the issue.
Changelog:
* lib/Locale/Po4a/Chooser.pm
Francois Gouget <fgouget(a)codeweavers.com>
Store '$@' in an intermediate variable so it does not get clobbered
before we report the plugin-load error.
--
Francois Gouget
fgouget(a)codeweavers.com
Index: lib/Locale/Po4a/Chooser.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Chooser.pm,v
retrieving revision 1.25
diff -u -p -r1.25 Chooser.pm
--- lib/Locale/Po4a/Chooser.pm 27 Feb 2005 23:32:02 -0000 1.25
+++ lib/Locale/Po4a/Chooser.pm 24 May 2005 17:45:50 -0000
@@ -41,9 +41,10 @@ sub new {
if (! UNIVERSAL::can("Locale::Po4a::$modname", 'new')) {
eval qq{use Locale::Po4a::$modname};
if ($@) {
+ my $error=$@;
warn wrap_msg(gettext("Unknown format type: %s."), $module);
warn wrap_mod("po4a::chooser",
- gettext("Module loading error: %s"), $@)
+ gettext("Module loading error: %s"), $error)
if defined $options{'verbose'} && $options{'verbose'} > 0;
list(1);
}
19 years, 5 months
[Po4a-devel]Fix encoding attribute handling in Xml.pm
by Francois Gouget
Wine's DobBook documentation is in SGML but I also tried the DocBook.pm
module on it. The nice thing is that it translates the 'lang' attribute.
The bad thing is that it does not handle including files using entities
and this is extensively used in Wine's documentation :-(.
Anyway, during this test I added the XML prologue recommended by the
DocBook documentation:
http://www.docbook.org/tdg/en/html/ch02.html#ch02-makexml
<?xml version='1.0'?>
<!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN"
"http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">
This caused the Xml.pm module to emit some 'Use of uninitialized value'
warnings because the <?xml> tag did not specify the encoding. That was
(or seemed) easy to fix so here's an hopefully correct patch:
Changelog:
* po4a/lib/Locale/Po4a/Xml.pm
Francois Gouget <fgouget(a)free.fr>
Append the encoding attribute if it is not defined in the <?xml> tag.
--
Francois Gouget fgouget(a)free.fr http://fgouget.free.fr/
$live{free} || die "";
19 years, 5 months
[Po4a-devel]Assorted documentation tweaks
by Francois Gouget
I have been reading the documentation further to understand better how
the various Perl modules fit together and this lead me to do some extra
tweaks along the way. So here they are...
Changelog:
* doc/po4a.7.pod
lib/Locale/Po4a/TransTractor.pm
Francois Gouget <fgouget(a)free.fr>
Assorted documentation tweaks and spelling fixes.
--
Francois Gouget fgouget(a)free.fr http://fgouget.free.fr/
Any sufficiently advanced Operating System is indistinguishable from Linux
19 years, 5 months
[Po4a-devel]Sgml.pm: Fix handling of the debug option
by Francois Gouget
Sgml.pm's debug option is a space separated list of 'channels' to print
debug information for. But its value was not being split which caused
the option not to work.
Changelog:
* lib/Locale/Po4a/Sgml.pm
Francois Gouget <fgouget(a)codeweavers.com>
The debug option is a space separated list of channels to print
information for. So we must split it to set $debug.
--
Francois Gouget
fgouget(a)codeweavers.com
Index: lib/Locale/Po4a/Sgml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v
retrieving revision 1.55
diff -u -p -r1.55 Sgml.pm
--- lib/Locale/Po4a/Sgml.pm 21 May 2005 18:42:21 -0000 1.55
+++ lib/Locale/Po4a/Sgml.pm 24 May 2005 11:47:01 -0000
@@ -217,7 +217,7 @@ sub initialize {
}
}
if ($options{'debug'}) {
- foreach ($options{'debug'}) {
+ foreach (split /\s+/, $options{'debug'}) {
$debug{$_} = 1;
}
}
19 years, 5 months
[Po4a-devel]Spelling fixes in Sgml.pm
by Francois Gouget
As I was reading Sgml.pm I found some spelling errors so I fixed them as
I went. I know it's not as good as new functionality or bug fixes but at
least that was an easy patch and it's one less thing for others to worry
about :-)
Changelog:
* po4a/lib/Locale/Po4a/Sgml.pm
Francois Gouget <fgouget(a)free.fr>
Assorted spelling fixes.
--
Francois Gouget fgouget(a)free.fr http://fgouget.free.fr/
Linux, WinNT, MS-DOS - also known as the Good, the Bad and the Ugly.
19 years, 5 months
[Po4a-devel]Simplify the tag kind verification
by Francois Gouget
set_tags_kind() uses this code to verify the tag kind:
if ($_ ne 'translate' && $_ ne 'empty' && $_ ne 'verbatim' && $_ ne 'ignore' && $_ ne 'indent');
This seemed pretty long and unclear so I changed it to the equivalent:
if ($_ !~ /^(translate|empty|verbatim|ignore|indent)$/);
Which I feel is more compact, readable and maintainable. But as I said
the two are functionally equivalent so it's partly a matter of taste.
Anyway, here's the patch.
Changelog:
* po4a/lib/Locale/Po4a/Sgml.pm
Francois Gouget <fgouget(a)free.fr>
Use a regular expression to simplify the tag kind check.
--
Francois Gouget fgouget(a)free.fr http://fgouget.free.fr/
Nouvelle version : les anciens bogues ont \xE9t\xE9 remplac\xE9s par de nouveaux.
19 years, 5 months