0% found this document useful (0 votes)
33 views2 pages

Translating

The document discusses how to translate the Contenido content management system. It explains that Contenido uses the GNU gettext tool library for internationalization. Translators can modify strings in .po files found in locale subdirectories. These files contain the original "msgid" and translated "msgstr" for each string. The menu is translated by editing an XML file. Translations can be tested by compiling the .po file into a .mo file using the msgfmt tool.

Uploaded by

Hassan Fethi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views2 pages

Translating

The document discusses how to translate the Contenido content management system. It explains that Contenido uses the GNU gettext tool library for internationalization. Translators can modify strings in .po files found in locale subdirectories. These files contain the original "msgid" and translated "msgstr" for each string. The menu is translated by editing an XML file. Translations can be tested by compiling the .po file into a .mo file using the msgfmt tool.

Uploaded by

Hassan Fethi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Translating Contenido 1

Timo A. Hummel

1 Translating Contenido
If you've translated Unix/Linux applications before, you might already know the GNU gettext tool library. If you do, you can immediately start
translating by using the .po files in the locale/<yourcode>/LC_MESSAGES/ directory. If you are new to the GNU gettext tool library and
concepts, read on.

1.1 How Contenido is internationalized


Contenido is currently translated using the GNU gettext tool library. Strings are directly edited in the source code, and are extracted after the
development so translators can directly translate the strings.
In the past, we have had so-called language variables. However, this system had a few drawbacks. Every time a new string was added to
Contenido, developers had to create a new language variable which afterwards had to be translated. If the variable wasn't translated yet, users
received an empty string or even a parse error.

1.2 How to translate


When the development of a new Contenido version has been finished, developers extract all strings using a special tool into so-called
language files. These files can be found in the directory contenido/locale/<LANGCODE>/LC_MESSAGES/. <LANGCODE> is the ISO country
code for your country, for Germany, this would be de_DE, and for Italy it would be it_IT. More codes can be found on
http://nscp.upenn.edu/aix4.3html/aixbman/baseadmn/locale.htm.
If you open the contenido.po file, you'll see the default messages and their translation:

msgid ""
msgstr ""
"Project-Id-Version: Contenido 4.3.2\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2003-06-18 13:22+0100\n"
"Last-Translator: Timo A. Hummel <[email protected]>\n"
"Language-Team: Contenido <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"

# E:/timo/contenido431/contenido/translationdemo.php:89
msgid "Welcome to My PHP Application\n"
msgstr "Benvenuto alla mia applicazione di PHP\n"

You can ignore the first lines, as they are not important for translation. The important lines are "msgid" and "msgstr". The "msgid" specifies the
source text, and the "msgstr" the translation. Thus, it's very easy to translate as you always see the original text and your translation. You can
also use "poEdit" which is a graphical frontend to .po files.

1.3 How to translate the menu


The contenido menu is a special case, where you need to edit the XML-File called "lang_de_DE.xml" for example. The string after "lang_" is
the same as in the locale directory, so for italian, you would have the file "lang_it_IT.xml" instead. Just copy the file, change the texts, and
insert the file into your config.php file.

1.4 How to integrate the translation


You can test your translation by running the application "msgfmt":
msgfmt contenido.po o contenido.mo
This command compiles the textual file "contenido.po" into a binary one called "contenido.mo". This has to be done for performance reasons. If
you can't run msgfmt yourself, just send your translated contenido.po file to us with the remark that you'd like to receive a compiled .mo file,
and we'll return the .mo file to you. If you are using poEdit, you don't need to call msgfmt yourself, poEdit does that for you.

2 Resources
2.1 poEdit
poEdit is available for both Linux and Windows. You can grab it at http://poedit.sourceforge.net/
Translating Contenido 2
Timo A. Hummel

2.2 GNU gettext


You can get GNU gettext from http://www.gnu.org/directory/gettext.html

You might also like