podebug, i18n testing tool

I caught many i18n bugs when translating applications. The most common one is that applications have untranslatable UI strings, which are caused from just not being wrapped with gettext in many cases. You can quickly fix them, but actually they are often overlooked. Now, how can you detect i18n problems like that?

Podebug will help you. It is an i18n testing tool. It enables you to insert debug markers into translatable strings so taht you can easily catch  strings not marked for translation in your application. For example, the following screenshot is swell-foop’s UI to whose strings I prepended a marker (“[i18n]”) with podebug. You can see a string not marked, “New”, in it (This problem has been already filed as 697978).

swell-foop with podebug

“New” on the toolbar does not have the marker. It means the string is untranslatable.

Usage

Podebug creates a pseudo message catalog. You just install it.

(Assuming that pwd is a swell-foop repo dir)
$ pwd  # swell-foop repo dir
/home/jiro/src/swell-foop
$ cd po$ intltool-update --pot  # generatte the pot (swell-foop.pot)
$ podebug --format='[i18n]' --input swell-foop.pot --output debug.po  # create pseudo po
processing 1 files...
[###########################################] 100%

An extract from swell-foop.pot

#: ../data/preferences.ui.h:1 ../data/swell-foop.desktop.in.in.h:1
#: ../src/swell-foop.vala:57 ../src/swell-foop.vala:388
#: ../src/swell-foop.vala:451
msgid "Swell Foop"
msgstr ""

#: ../data/preferences.ui.h:2
msgid "_Board size:"
msgstr ""

#: ../data/preferences.ui.h:3
msgid "_Number of colors:"
msgstr ""

#: ../data/preferences.ui.h:4
msgid "Setup"
msgstr ""

An extract from debug.po

#: ../data/preferences.ui.h:1 ../data/swell-foop.desktop.in.in.h:1
#: ../src/swell-foop.vala:57 ../src/swell-foop.vala:388
#: ../src/swell-foop.vala:451
msgid "Swell Foop"
msgstr "[i18n]Swell Foop"

#: ../data/preferences.ui.h:2
msgid "_Board size:"
msgstr "[i18n]_Board size:"

#: ../data/preferences.ui.h:3
msgid "_Number of colors:"
msgstr "[i18n]_Number of colors:"

#: ../data/preferences.ui.h:4
msgid "Setup"
msgstr "[i18n]Setup"

Install the pseudo message catalog

$ msgfmt debug.po -o debug.mo  # compile po into mo
$ mv debug.mo ${prefix}/share/locale/${locale}/LC_MESSAGES/swell-foop.mo  # install mo

Run your application

$ swell-foop