|
下面是一个转贴,来自:
http://kde.ground.cz/tiki-editpage.php?page=Quick+and+dirty+translation+of+manuals+using+KBabel
[code:1]
Translating a docbook manual
I was in the need of translating the english manual for my application to spanish. Looking in the web I didn't find anything besides the internationalization howto, so I expect this may be useful.
This is probably not the right way or the best way, but it worked for me.
I started with files already in XML format. The header in index.docbook is
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1-Based Variant V1.0//EN" "dtd/kdex.dtd"
and all the other .docbook files are included from it as entities. If the file is still in SGML convertion will be required; the i18n HOWTO covers that part.
From here I'll define four variables to make easier to understand the commands.
$PODIR is $HOME/src/kde/po;
$POTDIR is $HOME/src/kde/pot;
$ENDIR is $HOME/src/myapp/doc/en and
$ESDIR is $HOME/src/myapp/doc/es.
Using KBabel, I set $PODIR and $PODIR as the po and pot directory in KBabel's catalog manager. Probably a bad idea, but I'm not translating anything except my own application.
Then, for *.docbook in $ENDIR, I run 'xml2pot file.docbook > $POTDIR/file.pot'.
The .pot files are then in place. Using KBabel open the catalog manager and translate each and every message. After saving the .po file will be in $PODIR.
Once all the .po files are ready, it's time to use them to create new .docbook files. For every .po file run 'po2xml $ENDIR/file.docbook $PODIR/file.po > $ESDIR/file.docbook'.
The generated index.docbook required too setting the language. Change it in the line that says
<!ENTITY % English "INCLUDE"><!-- change language only here -->
I replaced English for Spanish.
With everything ready it's time to properly configure the autotools backend. The Makefile.am in $ESDIR should contain
KDE_LANG = es
KDE_DOCS = myapp
for spanish language. Don't forget either to add $ESDIR to the "SUBDIRS =" directive in the upper directory.
The last thing to do should be to run 'make -f Makefile.cvs' in top level; this will create the appropiate makefiles for the new directory. After doing "./configure; make; make install" calling 'help:/myapp' should display the documentation properly translated.[/code:1] |
|