12.2. 快速上手

The procedure shown in 節 1.2, “快速上手” is assumed to have already been performed, but the TRANSLATOR option must be enabled in the textproc/docproj port. If that option was not enabled, display the options menu and enable it, then reinstall the port:

# cd /usr/ports/textproc/docproj
# make config
# make clean deinstall install clean

This example shows the creation of a Spanish translation of the short Leap Seconds article.

過程 12.1. Install a PO Editor
過程 12.2. Initial Setup

When a new translation is first created, the directory structure and Makefile must be created or copied from the English original:

  1. 建立新翻譯的目錄。英文文章原始碼位於 ~/doc/en_US.ISO8859-1/articles/leap-seconds/ 。西班牙文翻譯將會放在 ~/doc/es_ES.ISO8859-1/articles/leap-seconds/ 。除了語系目錄的名稱外,其他路徑相同。

    % svn mkdir --parents ~/doc/es_ES.ISO8859-1/articles/leap-seconds/
  2. 從原始文件處將 Makefile 複製到翻譯目錄。

    % svn cp ~/doc/en_US.ISO8859-1/articles/leap-seconds/Makefile \
        ~/doc/es_ES.ISO8859-1/articles/leap-seconds/
過程 12.3. 翻譯

Translating a document consists of two steps: extracting translatable strings from the original document, and entering translations for those strings. These steps are repeated until the translator feels that enough of the document has been translated to produce a usable translated document.

  1. 從英文的原始文件提取字串到 PO 檔:

    % cd ~/doc/es_ES.ISO8859-1/articles/leap-seconds/
    % make po
  2. 使用 PO 編輯器將翻譯輸入 PO 檔。有幾個不同的編輯器可以使用。這裡用的是 editors/poeditpoedit

    PO 檔名是兩個字元的語系碼後面接底線和兩個字元的區域碼。以西班牙語來說,檔名是 es_ES.po

    % poedit es_ES.po
過程 12.4. Generating a Translated Document
  1. 產生翻譯文件

    % cd ~/doc/es_ES.ISO8859-1/articles/leap-seconds/
    % make tran

    產生的文件名稱與英文原始文件名稱相符,文章通常是 article.xml ,書籍是 book.xml

  2. 可以轉換成 HTML 來檢查產生的檔案,並用瀏覽器來察看。

    % make FORMATS=html
    % firefox article.html

本文及其他文件,可由此下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/

若有 FreeBSD 方面疑問,請先閱讀 FreeBSD 相關文件,如不能解決的話,再洽詢 <questions@FreeBSD.org>。

關於本文件的問題,請洽詢 <doc@FreeBSD.org>。