Dealing with series of comments in the XML module
by Kobayashi Noritada
Hi,
Test data for the XML module contain
<!-- The content of this document is licensed under the XXX license -->
<!-- See bla bla -->
as an input data and
<!-- The content of this document is licensed under the XXX license
See bla bla -->
as its corresponding output data. Does this mean that the conversion
of a series of comments into one comment is an expected behavior?
Since the Wml module temporarily converts '#'-headed comments into an
XML-syntax comments and uses the XML module for parsing, the
conversion of a series of comments results in a bug. I'd like to know
whether this should be fixed in the XML module or in the Wml
module. ;-)
Many thanks,
-nori
16 years, 8 months
Installing files outside PREFIX
by Kaloian Doganov
The current version of Po4a from CVS by default installs files not only
in /usr/local, but also in /usr/share. It looks like install procedure
does not honour PREFIX for all files. This goes far beyond one's
expectation that no files outside the PREFIX tree should be created or
overwritten.
16 years, 8 months
[PATCH] Some patches for the Po4a's Wml module
by Kobayashi Noritada
Hi,
I am working as a Japanese translator for Debian's web site and
considering whether we can handle translations in wml files with po
files. I don't think the current way of maintaining web page
translations is good since all the translations must be hard-coded in
the wml files, linked with CVS revisions and block-level markups. So,
I'm paying attention to the Po4a's Wml module. I have used Po4a for
translations of release notes and aptitude, and like the idea of that
software. ;-)
Since the Wml module seems to be still immature and somewhat buggy, I
provide some patches here. Could you please review and commit them?
# Or, shall I participate in this project and commit by myself? ;-)
Descriptions are below:
replacement.patch:
Correct a mistake: do replacing instead of matching.
Patch by: Kenshi Muto <kmuto(a)debian.org>
define-tag.patch:
Enable handling define-tag tags.
Patch by: Noritada Kobayashi <nori1(a)dolphin.c.u-tokyo.ac.jp>
charset.patch:
Enable handling input file charset correctly.
Patch by: Noritada Kobayashi <nori1(a)dolphin.c.u-tokyo.ac.jp>
I know these patches are not enough for making the Wml module usable.
I'd love to create more patches and try to make the Wml module
suitable for handling all pages in Debian's web site.
Thanks,
-nori
--- lib/Locale/Po4a/Wml.pm.orig 2008-02-28 18:48:23.000000000 +0900
+++ lib/Locale/Po4a/Wml.pm 2008-02-28 18:48:35.000000000 +0900
@@ -104,7 +104,7 @@
}
# Mask mp4h cruft
- while ($file =~ m|^#(.*)$|<!--PO4ASHARPBEGIN$1PO4ASHARPEND-->|m) {
+ while ($file =~ s|^#(.*)$|<!--PO4ASHARPBEGIN$1PO4ASHARPEND-->|m) {
my $line = $1;
print STDERR "PROTECT HEADER: $line\n";
if ($line =~ m/title="([^"]*)"/) { #) {#"){
--- lib/Locale/Po4a/Wml.pm.orig 2008-02-28 18:49:37.000000000 +0900
+++ lib/Locale/Po4a/Wml.pm 2008-02-28 18:51:59.000000000 +0900
@@ -111,6 +111,9 @@
warn "FIXME: We should translate the page title: $1\n";
}
}
+
+ # Validate define-tag tag's argument
+ $file =~ s|(<define-tag\s+)([^\s>]+)|$1PO4ADUMMYATTR="$2"|g;
# Flush the result to disk
open OUTFILE,">$tmp_filename";
@@ -136,6 +139,7 @@
$file = join("",@{$xmlizer->{TT}{doc_out}});
$file =~ s/^<!--PO4ASHARPBEGIN(.*?)PO4ASHARPEND-->/#$1/mg;
$file =~ s/<!--PO4ABEGINPERL(.*?)PO4AENDPERL-->/<:$1:>/msg;
+ $file =~ s|(<define-tag\s+)PO4ADUMMYATTR="([^"]*)"|$1$2|g;
$file =~ s/PO4ALT/</msg;
$file =~ s/PO4AGT/>/msg;
--- lib/Locale/Po4a/Wml.pm.orig 2008-02-28 18:51:59.000000000 +0900
+++ lib/Locale/Po4a/Wml.pm 2008-02-28 18:52:42.000000000 +0900
@@ -123,6 +123,7 @@
# Build the XML TransTractor which will do the job for us
my $xmlizer = Locale::Po4a::Chooser::new("xhtml");
+ $xmlizer->{TT}{'file_in_charset'}=$self->{TT}{'file_in_charset'};
$xmlizer->{TT}{po_in}=$self->{TT}{po_in};
$xmlizer->{TT}{po_out}=$self->{TT}{po_out};
16 years, 8 months
Turning off wrapping for a specific XHTML tag
by Kaloian Doganov
Using po4a to process XHTML documents, I have to turn of wrapping for a
specific XHTML tag (<script>) still considering the containing text as
translatable. Po4a's Xml module provides a way to specify this using
the `W' character in the `tags' option:
-o "tags=W<script>"
Unfortunately this leads to skipping the containing text of <script> as
non-translatable. I can avoid this by adding `tagsonly' option, but
this way I practically have to list all possible XHTML tags in `tags',
just to turn off wrapping for one of them.
It would be much easier if there was a way to specify this wrap-flag
individually for a tag, without having to deal with global
skipping/non-skipping of all mentioned tags.
--
Protect your digital freedom and privacy, eliminate DRM, learn more at
http://www.defectivebydesign.org/what_is_drm
16 years, 9 months
Deformed XHTML comments spanning multiple lines
by Kaloian Doganov
I've noticed that XHTML comments that span multiple lines are deformed
by po4a-translate. An additional empty line is inserted between every
two lines:
For example:
<!--
Keep link lines at 72 characters or lynx will break them poorly.
Obviously, we list ONLY the most useful/important URLs here.
Keep it short and sweet: 3 lines and 2 columns is already enough
-->
Results to:
<!--
Keep link lines at 72 characters or lynx will break them poorly.
Obviously, we list ONLY the most useful/important URLs here.
Keep it short and sweet: 3 lines and 2 columns is already enough
-->
This may be considered a cosmetic problem, but I've decided to report it
anyway.
16 years, 9 months