• Home
  • About me

Diego Búrigo Zacarão’s Weblog

Let me talk about something

Follow me
Twitter
Posts
Comments
« A possible alternative for the Tx widgets problem
Transifex :: I18n support splitted into two different Potfiles »

Transifex i18n support including the database

Jun 11th, 2008 by diegobz

Usually all apps with i18n support based on Potfiles just include the messages from the source code to the translatable files. It’s very common for desktop apps, but when you have a web app like Transifex, you need to have i18n support to the database too. So, that was my first challenge around the i18n support for Transifex.

The most important information stored in the Transifex database, and that it needs to be translatable, it is the descriptions and summaries of modules and repositories. Those information are displayed around the app in many situations and for a nice experience for the translators, they must to appear localized, following the Transifex interface.

After we migrate to genshi from kid we have started to use Babel to extract the messages from the source code of Transifex. Babel is a very usefull and interesting collection of tools for internationalizing Python applications and it provides an easy way to handle Potflies through its API. Thanks Rick Zhou to let me know.

Using the Babel API we can easily include more messages into an existing Potfile.

from babel.messages.pofile import read_po, write_po

catalog = read_po(file('app.pot', 'r'))
catalog.add(u'New entry to be translated')
write_po(file('app.pot', 'w'), catalog)

So, after we extract the messages from the source code of Transifex, we only need to select all descriptions and summaries of modules and repositories from the database and include them into the current Potfile. Simple and easy!

The python script that handles (extract/merge/compile) the Transifex i18n is called i18n.py and can be found currently here. Usefully this script can be changed to be used in others apps that use TG + Genshi with i18n support for both source code and database.

See the result using the pt_BR lang: http://publictest10.fedoraproject.org/submit-diegobz/module/

Posted in English, Fedora, GSoC, Transifex

Comments are closed.

  • Recent Posts

    • Enabling apache UserDir (public_html) with SELinux enabled on Fedora
    • Metallica, Porto Alegre, Brasil – 28/01/2010
    • It’s been 1 year of Indifex
    • Running Transifex with PostgreSQL on Fedora
    • Unicode usernames in Django admin panel
    • Where do people in my blog come from?
  • Twitter Updates

      more updates...
    • Translate this page

    • Categories

      • Django (5)
      • English (45)
      • Europe (18)
      • Event (6)
      • Fedora (47)
      • FISL (5)
      • FUDCon (5)
      • GSoC (11)
      • Indifex (1)
      • Mini-post (5)
      • Photos (12)
      • PHP (1)
      • Português (14)
      • SELinux (1)
      • Transifex (30)

    Diego Búrigo Zacarão’s Weblog © 2008-2010 All Rights Reserved.

    Cool WordPress Themes | WordPress Rocks!