如何翻译docbook类型的手册(转贴)
下面是一个转贴,来自:http://kde.ground.cz/tiki-editpage.php?page=Quick+and+dirty+translation+of+manuals+using+KBabel
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 toproperly 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. 我的MagicLinux没有xml2pot和po2xml这两个程序,请大家帮帮忙,把如下的index.docbook转换一下。 这两个程序应该是在kdesdk-xml2pot这个软件包里,不知道MagicLinux管这个包叫什么。 为什么要先把 xml 转成 pot,在翻译之后再转回来呢?
直接翻译不能么?这么做难道有什么好处? 如果原文变化了怎么办?重新来过吗?
相比之下,gettext技术比较成熟,尤其是msgmerge程序,可以实现对已有翻译资源的充分利用。 我转化成pot文件翻译后,再转成xml格式之后,用kwrite查看中文变成了乱码。
编码格式都是UTF-8。
郁闷啊 UTF-8格式是通用的格式,没啥可奇怪的。Kwrite的打开对话框中有地方让你选择编码,仔细找找。 好的。
xml2pot和po2xml是你开发的吧? 我还没这个本事。 如果原文变化了怎么办?重新来过吗?
相比之下,gettext技术比较成熟,尤其是msgmerge程序,可以实现对已有翻译资源的充分利用。
作 diff 合并修改啊 如果原文变化了怎么办?重新来过吗?
相比之下,gettext技术比较成熟,尤其是msgmerge程序,可以实现对已有翻译资源的充分利用。
作 diff 合并修改啊
你想得倒简单,如果那么简单,官方要使用 po 格式,岂不都是弱智?不信你就试试。 我转化成pot文件翻译后,再转成xml格式之后,用kwrite查看中文变成了乱码。
编码格式都是UTF-8。
郁闷啊
标准翻译环境应该使用 UTF-8 编码,这是国际惯例。你看看 i18n 主页上工作流程部分的说明。使用 GB2312 会带来兼容问题。 如果原文变化了怎么办?重新来过吗?
相比之下,gettext技术比较成熟,尤其是msgmerge程序,可以实现对已有翻译资源的充分利用。
作 diff 合并修改啊
我们做个假设。如果原文的第一版没有经过tidy的缩进处理,而第二版经过了tidy的缩进美化。那么拿第二版和第一版来做diff,必然是全篇完全不同。这样的diff结果又有什么参考意义呢? 哦,原来是这个样子,看来具体情况还真要具体分析。 我转化成pot文件翻译后,再转成xml格式之后,用kwrite查看中文变成了乱码。
编码格式都是UTF-8。
郁闷啊
标准翻译环境应该使用 UTF-8 编码,这是国际惯例。你看看 i18n 主页上工作流程部分的说明。使用 GB2312 会带来兼容问题。
ok,今天打算搞定它。
页:
[1]
2