doc-i18n-tool (fwd)

Simos Xenitellis simos74 at
Thu Oct 11 01:32:09 EEST 2001

Ίσως το παρακάτω εργαλείο σας φανεί χρήσιμο.
Δεν κατάφερα να το μεταγλωττίσω λόγω του ότι θέλει libxml2.
Μετατρέπει τα αρχεία μεταφράσεων μεταξύ po και xml.
Πιστεύω ότι μπορεί να χρησιμοποιηθεί με το λεξικό του Δημήτρη κατά την
αυτόματη μετάφραση αρχείων po.


---------- Forwarded message ----------
Date: 10 Oct 2001 14:38:02 -0400
From: Jonathan Blandford <jrb at>
To: Daniel Veillard <veillard at>, Darin Adler <darin at>,
     gnome-doc-list at, gnome-i18n at
Subject: doc-i18n-tool


Daniel and I managed to whip up a small tool for generating a pot file
to and from a sgml/xml file.  It seems to work pretty well for a quick
hack, and I don't know how complicated this needs to be.  It needs a
little cleaning up ('--help' doesn't work and there are other argument
oddities) and a man page as well, but it might be worth starting to work
with it.

Should we try to put this in intl-tools?  It's Darin's call of course,
but I think that if it manages to increase the number of translated docs
then it's a good thing.  As a non-translator, I'd appreciate it if those
actually doing the translating could provide feedback.


I'm including the source file and a simple Makefile.  You need
libxml2-devel installed in order to build it, but it should just work on
most modern systems.

To create a pot file, you need to do:

% doc-i18n-tool --output-pot-file file.xml > file.pot

You can add the --sgml flag if want to parse an sgml file.
Additionally, I think we really want to do something like:

% xmllint --noblanks file.xml | doc-i18n-tool --output-pot-file --filename file.xml -- - > file.pot

This will minimize chance that random white-space changes will effect
the doc.  It doesn't really matter, so long as we're consistent.

Once you have the pot file, we can translate it, and convert it back by
doing (in Norwegian in this case -- use your own language):

% msgfmt translatedfile.pot -o
% mkdir -p no/LC_MESSAGES

Finally, convert it back to SGML by doing:

% LANG=no_NO doc-i18n-tool --package file --localedir `pwd` file.xml | xmllint --format > file-no.xml

Note: If you originally created the pot file using 'xmllint --noblanks',
you need to do the same here.


It'd be nice to move to docbook xml ASAP, as we can use the xmllint
tool, then.  Daniel, can we add a --sgml style arg to xmllint to handle
docbook-sgml?  There's no reason we'd want to ever install these po
files, as this should be done in CVS by the translator.

Another problem is that we are over-sensitive.  Ie, if we run into
passages like: <para>... mail to <email>accounts at</email>
with...</para>, we probably don't want to do the <email> section
separately.  It think we'll need to add some docbook specific hacks to
catch 'leaf' nodes like this to condense into the doc.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: doc-i18n-tool.c
Type: application/octet-stream
Size: 5847 bytes
Desc: doc-i18n-tool.c
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 161 bytes
Desc: Makefile
URL: <>

More information about the I18ngr mailing list