Request For Help Preparing ClassBot For Translations

A few weeks ago, I was approached by some people from the Ubuntu Classroom-ES about having a Spanish version of ClassBot to help out with their Open Week. Thanks to some help with translations, I was able to create ClaseBot. The problem is, due to the way that the translations were done, if I make a change to the ClassBot code, it will have to be manually applied to ClaseBot. Ideally, I would like to have ClassBot setup to use Launchpad to allow people to translate it. The problem is that I have no experience using Gettext or with using Launchpad for translations. ClassBot is also a Perl script, so that also makes it a bit more challenging to find examples. If there is someone who has a bit more experience in this area, please get in contact with me.

This entry was posted in Planet Ubuntu. Bookmark the permalink.

2 Responses to Request For Help Preparing ClassBot For Translations

  1. David says:

    From a high-level view, the workflow would be the following:

    1. Set up the script for localization. This will include: integrating gettext in the build system, initialize gettext in the code, mark the strings for translation. This [1] can be helpful.

    2. Extract the strings to make them available to translators. Generally running a script that ultimately invokes xgettext and produces a POT template file (e.g. ClassBot.pot). Translators work from this file and create their own translation

    3. Integrate translations in the code. This will generally mean committing the PO files containing the translations (e.g. ca.po, es.po, de.po, it.po, etc) and building them, that is, converting them to the binary format (MO files) that gettext understands and can load.

    Once 1 and 2 are set up, it is fairly trivial to expose those translations in Launchpad (enable translations for the project, choose a translation policy -recommended: Restricted-, chose a translation group -recommended: Ubuntu Translators-, enable automatic template imports and automatic translation exports)

    Just ping me if I can be of any help.


  2. David says:

    Also, having had a quick look at the /usr/share/doc/gettext-doc/examples/hello-perl example from the gettext-doc package, it seems that the first step is to add the following to the start of to initialise gettext (you’ll need to have installed the libint-perl package on the target system):

    use Locale::TextDomain ("hello-perl" => "/usr/share/locale");
    use POSIX qw(getpid);

    binmode STDOUT, ':raw'; # Needed to make it work in UTF-8 locales in Perl-5.8.

    After that, you’ll need to mark the translatable strings. The hello-perl example shows how to do it with printed strings (just prepending them with double underscore __):

    print __”Hello, world!”;

    But you are using Irssi:print(), so as I’m by no means a perl expert, I’m not sure whether they can just be marked like that there. In any case, the documentation on gettext for perl on the previous comment seems to have some more in depth info on that.

    I hope that helps as a kickstart

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s