Translate GNU Gettext .po, .pot files

WebTranslateIt supports Gettext .po/.pot files. Before importing, the language file will be checked by the utility msgfmt before importing.

Validation

WebTranslateIt checks if the .po file is valid before importing using the utility msgfmt. If your import fails, an error message is displayed. You can investigate your file further by running in a terminal:

$ msgfmt file.po

Beware the BOM

$ msgfmt -v -C default.po
default.po:1:2: syntax error
msgfmt: found 1 fatal error

If you get this error and nothing obviously wrong is located on line 1, column 2, then it is very likely that your file contains a byte order mark. WebTranslateIt could handle your file, but it is not legit to gettext. In order to fix your file, remove the BOM and upload the file to WebTranslateIt again. On Windows, tools such as Notepad++ have an option to remove the BOM (“Encoding » Convert to UTF-8 without BOM”).

Plural strings completeness

Incompletely translated plural strings (i.e. plural strings missing one or several plural rules) are exported as untranslated, as incomplete plural strings can break your application.

Encoding Detection

The file encoding sometimes is hard to detect reliably. In order to reliably import the file in the correct encoding, make sure the file encoding is described in your file headers:

#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OLPC website files Version 1.2\n"
"POT-Creation-Date: 2006-02-14 12:00-0500\n"
"PO-Revision-Date: 2006-08-27 15:00-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

Having Content-Type: text/plain; charset=utf-8 will make sure your file is imported as UTF-8.

.pot file example

Here’s an example of .pot file. WebTranslateIt imports instructions starting by a #..

#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: OLPC website files Version 1.2\n"
"POT-Creation-Date: 2006-02-14 12:00-0500\n"
"PO-Revision-Date: 2006-08-27 15:00-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "align"
msgstr "_: the alignment (left or right) of your language goes here"

#: laptop.html
#. An instruction to translators
msgid "title"
msgstr "One Laptop per Child"

msgid "intro"
msgstr "Introducing the children's laptop..."    

.po file example

# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR VideoLAN
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: vlc-devel@videolan.org\n"
"POT-Creation-Date: 2009-03-26 21:58+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 1.3.0\n"

#: include/vlc_common.h:879
msgid ""
"This program comes with NO WARRANTY, to the extent permitted by law.\n"
"You may redistribute it under the terms of the GNU General Public License;\n"
"see the file named COPYING for details.\n"
"Written by the VideoLAN team; see the AUTHORS file.\n"
msgstr ""
"Ce programme est fourni SANS AUCUNE GARANTIE, tel que permis par la loi.\n"
"Vous pouvez le redistribuer selon les termes de la Licence Publique Générale "
"GNU ;\n"
"voir le fichier COPYING pour plus de détails.\n"
"Écrit par l’équipe VideoLAN ; voir le fichier AUTHORS.\n"

#: include/vlc_config_cat.h:32
msgid "VLC preferences"
msgstr "Préférences de VLC"

#: include/vlc_config_cat.h:34
msgid "Select \"Advanced Options\" to see all options."
msgstr "Cliquez sur « Options avancées » pour voir toutes les options."

#: include/vlc_config_cat.h:37 modules/gui/macosx/simple_prefs.m:174
#: modules/gui/qt4/components/simple_preferences.cpp:77
#: modules/gui/qt4/menus.cpp:952 modules/misc/dummy/dummy.c:68
msgid "Interface"
msgstr "Interface"

msgid "Deine Nachricht enthält einen Fehler"
msgid_plural "Deine Nachricht enthält %{num} Fehler"
msgstr[0] "Deine Nachricht enthält einen Fehler:"
msgstr[1] "Deine Nachricht enthält %{num} Fehler:"

More Information