English Norwegian Bokmål
Chapter 9. PO Translations
PO Translations
The http://www.gnu.org/software/gettext/[GNU gettext] system offers translators an easy way to create and maintain translations of documents. Translatable strings are extracted from the original document into a PO (Portable Object) file. Translated versions of the strings are entered with a separate editor. The strings can be used directly or built into a complete translated version of the original document.
Quick Start
The procedure shown in <<overview-quick-start>> is assumed to have already been performed. The `TRANSLATOR` option is required and already enabled by default in the package:textproc/docproj[] port.
This example shows the creation of a Spanish translation of the short link:{leap-seconds}[Leap Seconds] article.
Procedure: Install a PO Editor
A PO editor is needed to edit translation files. This example uses package:editors/poedit[].
# cd /usr/ports/editors/poedit
# make install clean
Procedure: Initial Setup
When a new translation is first created, the directory structure must be created or copied from the English original:
Create a directory for the new translation. The English article source is in [.filename]#~/doc/en/articles/leap-seconds/#. The Spanish translation will go in [.filename]#~/doc/es/articles/leap-seconds/#. The path is the same except for the name of the language directory.
% mkdir ~/doc/es/articles/leap-seconds/
Copy the [.filename]#_index.adoc# from the original document into the translation directory:
% cp ~/doc/en/articles/leap-seconds/_index.adoc \
Procedure: Translation
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/articles/leap-seconds/
% po4a-gettextize --format asciidoc --master _index.adoc --master-charset "UTF-8" >> es.pot