Debian Codegraph @

zh/00_readme_first.html

raw symbols SCIP
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.3.0" />
7 <title>翻译 DocBook 文档的方法</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11 /*
12 border: 1px solid red;
13 */
14 }
15
16 body {
17 margin: 1em 5% 1em 5%;
18 }
19
20 a {
21 color: blue;
22 text-decoration: underline;
23 }
24 a:visited {
25 color: fuchsia;
26 }
27
28 em {
29 font-style: italic;
30 color: navy;
31 }
32
33 strong {
34 font-weight: bold;
35 color: #083194;
36 }
37
38 tt {
39 color: navy;
40 }
41
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
48 }
49
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
52 }
53 h2 {
54 padding-top: 0.5em;
55 }
56 h3 {
57 float: left;
58 }
59 h3 + * {
60 clear: left;
61 }
62
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
66 }
67
68 hr {
69 border: 1px solid silver;
70 }
71
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
75 }
76
77 ul, ol, li > p {
78 margin-top: 0;
79 }
80
81 pre {
82 padding: 0;
83 margin: 0;
84 }
85
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
91 }
92 span#email {
93 }
94 span#revision {
95 font-family: sans-serif;
96 }
97
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
104 }
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
108 }
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
112 }
113
114 div#preamble,
115 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
116 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
117 div.admonitionblock {
118 margin-right: 10%;
119 margin-top: 1.5em;
120 margin-bottom: 1.5em;
121 }
122 div.admonitionblock {
123 margin-top: 2.5em;
124 margin-bottom: 2.5em;
125 }
126
127 div.content { /* Block element content. */
128 padding: 0;
129 }
130
131 /* Block element titles. */
132 div.title, caption.title {
133 color: #527bbd;
134 font-family: sans-serif;
135 font-weight: bold;
136 text-align: left;
137 margin-top: 1.0em;
138 margin-bottom: 0.5em;
139 }
140 div.title + * {
141 margin-top: 0;
142 }
143
144 td div.title:first-child {
145 margin-top: 0.0em;
146 }
147 div.content div.title:first-child {
148 margin-top: 0.0em;
149 }
150 div.content + div.title {
151 margin-top: 0.0em;
152 }
153
154 div.sidebarblock > div.content {
155 background: #ffffee;
156 border: 1px solid silver;
157 padding: 0.5em;
158 }
159
160 div.listingblock {
161 margin-right: 0%;
162 }
163 div.listingblock > div.content {
164 border: 1px solid silver;
165 background: #f4f4f4;
166 padding: 0.5em;
167 }
168
169 div.quoteblock {
170 padding-left: 2.0em;
171 }
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
175 }
176
177 div.verseblock {
178 padding-left: 2.0em;
179 }
180 div.verseblock > div.content {
181 white-space: pre;
182 }
183 div.verseblock > div.attribution {
184 padding-top: 0.75em;
185 text-align: left;
186 }
187 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
188 div.verseblock + div.attribution {
189 text-align: left;
190 }
191
192 div.admonitionblock .icon {
193 vertical-align: top;
194 font-size: 1.1em;
195 font-weight: bold;
196 text-decoration: underline;
197 color: #527bbd;
198 padding-right: 0.5em;
199 }
200 div.admonitionblock td.content {
201 padding-left: 0.5em;
202 border-left: 2px solid silver;
203 }
204
205 div.exampleblock > div.content {
206 border-left: 2px solid silver;
207 padding: 0.5em;
208 }
209
210 div.imageblock div.content { padding-left: 0; }
211 div.imageblock img { border: 1px solid silver; }
212 span.image img { border-style: none; }
213
214 dl {
215 margin-top: 0.8em;
216 margin-bottom: 0.8em;
217 }
218 dt {
219 margin-top: 0.5em;
220 margin-bottom: 0;
221 font-style: normal;
222 color: navy;
223 }
224 dd > *:first-child {
225 margin-top: 0.1em;
226 }
227
228 ul, ol {
229 list-style-position: outside;
230 }
231 div.olist > ol {
232 list-style-type: decimal;
233 }
234 div.olist2 > ol {
235 list-style-type: lower-alpha;
236 }
237
238 div.compact ul, div.compact ol,
239 div.compact p, div.compact p,
240 div.compact div, div.compact div {
241 margin-top: 0.1em;
242 margin-bottom: 0.1em;
243 }
244
245 div.tableblock > table {
246 border: 3px solid #527bbd;
247 }
248 thead {
249 font-family: sans-serif;
250 font-weight: bold;
251 }
252 tfoot {
253 font-weight: bold;
254 }
255 td > div.verse {
256 white-space: pre;
257 }
258 p.table {
259 margin-top: 0;
260 }
261 /* Because the table frame attribute is overriden by CSS in most browsers. */
262 div.tableblock > table[frame="void"] {
263 border-style: none;
264 }
265 div.tableblock > table[frame="hsides"] {
266 border-left-style: none;
267 border-right-style: none;
268 }
269 div.tableblock > table[frame="vsides"] {
270 border-top-style: none;
271 border-bottom-style: none;
272 }
273
274
275 div.hdlist {
276 margin-top: 0.8em;
277 margin-bottom: 0.8em;
278 }
279 div.hdlist tr {
280 padding-bottom: 15px;
281 }
282 dt.hdlist1.strong, td.hdlist1.strong {
283 font-weight: bold;
284 }
285 td.hdlist1 {
286 vertical-align: top;
287 font-style: normal;
288 padding-right: 0.8em;
289 color: navy;
290 }
291 td.hdlist2 {
292 vertical-align: top;
293 }
294 div.hdlist.compact tr {
295 margin: 0;
296 padding-bottom: 0;
297 }
298
299 @media print {
300 div#footer-badges { display: none; }
301 }
302
303 div#toctitle {
304 color: #527bbd;
305 font-family: sans-serif;
306 font-size: 1.1em;
307 font-weight: bold;
308 margin-top: 1.0em;
309 margin-bottom: 0.1em;
310 }
311
312 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
313 margin-top: 0;
314 margin-bottom: 0;
315 }
316 div.toclevel2 {
317 margin-left: 2em;
318 font-size: 0.9em;
319 }
320 div.toclevel3 {
321 margin-left: 4em;
322 font-size: 0.9em;
323 }
324 div.toclevel4 {
325 margin-left: 6em;
326 font-size: 0.9em;
327 }
328 /* Workarounds for IE6's broken and incomplete CSS2. */
329
330 div.sidebar-content {
331 background: #ffffee;
332 border: 1px solid silver;
333 padding: 0.5em;
334 }
335 div.sidebar-title, div.image-title {
336 color: #527bbd;
337 font-family: sans-serif;
338 font-weight: bold;
339 margin-top: 0.0em;
340 margin-bottom: 0.5em;
341 }
342
343 div.listingblock div.content {
344 border: 1px solid silver;
345 background: #f4f4f4;
346 padding: 0.5em;
347 }
348
349 div.quoteblock-attribution {
350 padding-top: 0.5em;
351 text-align: right;
352 }
353
354 div.verseblock-content {
355 white-space: pre;
356 }
357 div.verseblock-attribution {
358 padding-top: 0.75em;
359 text-align: left;
360 }
361
362 div.exampleblock-content {
363 border-left: 2px solid silver;
364 padding-left: 0.5em;
365 }
366
367 /* IE6 sets dynamically generated links as visited. */
368 div#toc a:visited { color: blue; }
369
370 /* Because IE6 child selector is broken. */
371 div.olist2 ol {
372 list-style-type: lower-alpha;
373 }
374 div.olist2 div.olist ol {
375 list-style-type: decimal;
376 }
377 </style>
378 <script type="text/javascript">
379 /*<![CDATA[*/
380 window.onload = function(){generateToc(3)}
381 /* Author: Mihai Bazon, September 2002
382 * http://students.infoiasi.ro/~mishoo
383 *
384 * Table Of Content generator
385 * Version: 0.4
386 *
387 * Feel free to use this script under the terms of the GNU General Public
388 * License, as long as you do not remove or alter this notice.
389 */
390
391 /* modified by Troy D. Hanson, September 2006. License: GPL */
392 /* modified by Stuart Rackham, October 2006. License: GPL */
393
394 function getText(el) {
395 var text = "";
396 for (var i = el.firstChild; i != null; i = i.nextSibling) {
397 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
398 text += i.data;
399 else if (i.firstChild != null)
400 text += getText(i);
401 }
402 return text;
403 }
404
405 function TocEntry(el, text, toclevel) {
406 this.element = el;
407 this.text = text;
408 this.toclevel = toclevel;
409 }
410
411 function tocEntries(el, toclevels) {
412 var result = new Array;
413 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
414 // Function that scans the DOM tree for header elements (the DOM2
415 // nodeIterator API would be a better technique but not supported by all
416 // browsers).
417 var iterate = function (el) {
418 for (var i = el.firstChild; i != null; i = i.nextSibling) {
419 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
420 var mo = re.exec(i.tagName)
421 if (mo)
422 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
423 iterate(i);
424 }
425 }
426 }
427 iterate(el);
428 return result;
429 }
430
431 // This function does the work. toclevels = 1..4.
432 function generateToc(toclevels) {
433 var toc = document.getElementById("toc");
434 var entries = tocEntries(document.getElementsByTagName("body")[0], toclevels);
435 for (var i = 0; i < entries.length; ++i) {
436 var entry = entries[i];
437 if (entry.element.id == "")
438 entry.element.id = "toc" + i;
439 var a = document.createElement("a");
440 a.href = "#" + entry.element.id;
441 a.appendChild(document.createTextNode(entry.text));
442 var div = document.createElement("div");
443 div.appendChild(a);
444 div.className = "toclevel" + entry.toclevel;
445 toc.appendChild(div);
446 }
447 if (entries.length == 0)
448 document.getElementById("header").removeChild(toc);
449 }
450 /*]]>*/
451 </script>
452 </head>
453 <body>
454 <div id="header">
455 <h1>翻译 DocBook 文档的方法</h1>
456 <div id="toc">
457 <div id="toctitle">Table of Contents</div>
458 <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
459 </div>
460 </div>
461 <h2 id="_docbook">1. docbook 的开发资源</h2>
462 <div class="sectionbody">
463 <div class="ulist"><ul>
464 <li>
465 <p>
466 <a href="http://docbook.org/">http://docbook.org/</a>
467 </p>
468 </li>
469 <li>
470 <p>
471 <a href="http://docbook.sourceforge.net/">http://docbook.sourceforge.net/</a>
472 </p>
473 </li>
474 <li>
475 <p>
476 <a href="http://sourceforge.net/projects/docbook/">http://sourceforge.net/projects/docbook/</a>
477 </p>
478 </li>
479 <li>
480 <p>
481 <a href="http://docbook.svn.sourceforge.net/svnroot/docbook/">DocBook SVN</a>
482 </p>
483 </li>
484 <li>
485 <p>
486 <a href="http://www.sagehill.net/docbookxsl/">DocBook XSL: The Complete Guide</a>
487 </p>
488 </li>
489 </ul></div>
490 </div>
491 <h2 id="_defguide">2. defguide 的翻译方法</h2>
492 <div class="sectionbody">
493 <h3 id="_po">2.1. 更新 po 文件</h3><div style="clear:left"></div>
494 <div class="listingblock">
495 <div class="content">
496 <pre><tt> msgmerge --width=80 --sort-by-file -o zh_new.po zh.po defguide.pot
497 mv -f zh_new.po zh.po</tt></pre>
498 </div></div>
499 <h3 id="_po_2">2.2. 翻译 po 文件</h3><div style="clear:left"></div>
500 <div class="paragraph"><p>使用 poedit 或 KBabel,甚至普通文本编辑器。</p></div>
501 <h3 id="_">2.3. 查阅上下文</h3><div style="clear:left"></div>
502 <div class="paragraph"><p>如果翻译时不能确定语义环境,那么请运行 ant pot,则对应的条目有其在
503 source/defguide.xml 中的位置,例如:</p></div>
504 <div class="listingblock">
505 <div class="content">
506 <pre><tt> #. (para)
507 #: ../source/defguide.xml:8360
508 msgid "Add new elements"
509 msgstr "增加元素"</tt></pre>
510 </div></div>
511 <div class="literalblock">
512 <div class="content">
513 <pre><tt>打开 source/defguide.xml,定位到 8360 行即可。</tt></pre>
514 </div></div>
515 <h3 id="_po_3">2.4. 格式化 po 文件</h3><div style="clear:left"></div>
516 <div class="paragraph"><p>统一采用 80 列宽,按照文件位置排序的 gettext 翻译格式,请在提交之前先格式化
517 po 文件。</p></div>
518 <div class="paragraph"><p>gettext 的 Windows 平台二进制包可以从 i18n-zh 下载。</p></div>
519 <div class="listingblock">
520 <div class="content">
521 <pre><tt> msgcat --width=80 --sort-by-file -o zh_new.po zh.po
522 mv -f zh_new.po zh.po</tt></pre>
523 </div></div>
524 <h3 id="_po_4">2.5. 合并 po 文件</h3><div style="clear:left"></div>
525 <div class="paragraph"><p>如果合作者有约定协作翻译的方法,请略过本节。</p></div>
526 <div class="paragraph"><p>下面的例子是以他人的翻译(zh-other.po)为准合并。如果需要以自己的翻译(zh.po)
527 为准合并,交换下述命令中的 zh.po 和 zh-other.po 即可。</p></div>
528 <h4 id="_subversion_po_merge_py">2.5.1. 使用 Subversion 的 po-merge.py</h4>
529 <div class="listingblock">
530 <div class="content">
531 <pre><tt> subversion/tools/dev/po-merge.py zh.po &lt; zh-other.po</tt></pre>
532 </div></div>
533 <h4 id="_translation_tookit_pomerge">2.5.2. 使用 translation tookit 的 pomerge</h4>
534 <div class="listingblock">
535 <div class="content">
536 <pre><tt> pomerge -i zh-other.po -o zh-new.po -t zh.po</tt></pre>
537 </div></div>
538 <h3 id="_po_5">2.6. 检查 po 文件</h3><div style="clear:left"></div>
539 <div class="listingblock">
540 <div class="content">
541 <pre><tt> msgfmt --statistics -c zh.po</tt></pre>
542 </div></div>
543 </div>
544 <h2 id="_defguide_2">3. defguide 的构建方法</h2>
545 <div class="sectionbody">
546 <h3 id="__2">3.1. 安装软件包</h3><div style="clear:left"></div>
547 <div class="paragraph"><p>在 Debian 系统中,安装方法如下:</p></div>
548 <div class="listingblock">
549 <div class="content">
550 <pre><tt>% sudo apt-get install openjdk-6-jdk ant ant-optional libbsf-java bsh \
551 libsaxon-java docbook-xml docbook-xsl python-libxml2 gettext</tt></pre>
552 </div></div>
553 <div class="paragraph"><p>对于其它系统,请参考 Debian 系统的安装方法。</p></div>
554 <div class="paragraph"><p>此外,还需要手工安装 docbook 5.0 和 RELAX NG Support(jing),配置 ant
555 支持 BeanShell 脚本。如果要生成 pdf,还需要安装中文字体,以及 fop trunk
556 2008-09-25(r698670) 以上版本。</p></div>
557 <h3 id="__3">3.2. 配置构建环境</h3><div style="clear:left"></div>
558 <div class="paragraph"><p>请根据 build.properties.tmpl 创建 build.properties:</p></div>
559 <div class="listingblock">
560 <div class="content">
561 <pre><tt>docbook5.home ----- docbook 5.0 安装的根目录
562 docbook.xsl ------- docbook-xsl 安装的根目录(e.g. /usr/share/xml/docbook/stylesheet/nwalsh)
563 usr.share.java ---- 存放共享 jar 文件的目录(e.g. /usr/share/java)</tt></pre>
564 </div></div>
565 <h3 id="_xml_catalog">3.3. 配置 xml catalog</h3><div style="clear:left"></div>
566 <div class="paragraph"><p>在 Debian 系统中,直接复制 CatalogManager.properties.tmpl
567 为 CatalogManager.properties,放到 ${usr.share.java} 目录即可。
568 对于其它系统,可能需要少许修改。</p></div>
569 <div class="listingblock">
570 <div class="content">
571 <pre><tt>catalogs=/etc/xml/catalog
572 relative-catalogs=true
573 static-catalog=yes
574 catalog-class-name=org.apache.xml.resolver.Resolver
575 verbosity=1</tt></pre>
576 </div></div>
577 <h3 id="__4">3.4. 配置构建环境</h3><div style="clear:left"></div>
578 <div class="paragraph"><p>然后就可以构建 html 或 pdf 输出格式的文档了:</p></div>
579 <div class="listingblock">
580 <div class="content">
581 <pre><tt>Building 'The Definitive Guide' - html
582 $ ant html
583
584 Building 'The Definitive Guide' - pdf
585 $ ant pdf</tt></pre>
586 </div></div>
587 <div class="paragraph"><p>请付出耐心,因为在 Intel Xeon 2.00GHz 的主机上,完全构建 html
588 需要近 100 分钟,完全构建 pdf 需要近 80 分钟。</p></div>
589 <div class="paragraph"><p>祝你好运!</p></div>
590 </div>
591 <div id="footer">
592 <div id="footer-text">
593 Last updated 2008-12-11 17:00:53 中国标准时间
594 </div>
595 </div>
596 </body>
597 </html>