The procedure shown in
Section 1.1, “Quick Start” is assumed to have
already been performed. The TRANSLATOR
option is required and already enabled by default in the
textproc/docproj port.
This example shows the creation of a Spanish translation of the short Leap Seconds article.
A PO editor is needed to edit translation files. This example uses editors/poedit.
#
cd /usr/ports/editors/poedit
#
make install clean
When a new translation is first created, the directory
structure and Makefile
must be created or
copied from the English original:
Create a directory for the new translation. The
English article source is in
~/doc/en_US.ISO8859-1/articles/leap-seconds/
.
The Spanish translation will go in
~/doc/es_ES.ISO8859-1/articles/leap-seconds/
.
The path is the same except for the name of the language
directory.
%
svn mkdir --parents ~/doc/es_ES.ISO8859-1/articles/leap-seconds/
Copy the Makefile
from the original
document into the translation directory:
%
svn cp ~/doc/en_US.ISO8859-1/articles/leap-seconds/Makefile \ ~/doc/es_ES.ISO8859-1/articles/leap-seconds/
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.
Extract the translatable strings from the original English version into a PO file:
%
cd ~/doc/es_ES.ISO8859-1/articles/leap-seconds/
%
make po
Use a PO editor to enter translations
in the PO file. There are several
different editors available. poedit
from editors/poedit is shown
here.
The PO file name is the
two-character language code followed by an underline and a
two-character region code. For Spanish, the file name is
es_ES.po
.
%
poedit es_ES.po
Generate the translated document:
%
cd ~/doc/es_ES.ISO8859-1/articles/leap-seconds/
%
make tran
The name of the generated document matches the name
of the English original, usually
article.xml
for articles or
book.xml
for books.
Check the generated file by rendering it to HTML and viewing it with a web browser:
%
make FORMATS=html
%
firefox article.html
All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/
Questions that are not answered by the
documentation may be
sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.