Category Archives: Translations

Translations imported

The language files from the GLM svn repository have finally been imported into Launchpad Translations. You can see the progress of each language with the Translation overview on Launchpad (click on “View all languages”).

Translation progressThe translation files had been in the GGL bzr repository for some time now, but they weren’t being imported by Launchpad. In order for the translation files to be automatically imported, one must follow the Import policy. This policy describes the following rules when uploading translation files:

  • The file must be in GNU gettext .po format.
  • Translation files should be in the same directory as the template to which they relate.
  • The translation files should be named for the appropriate language code: e.g. pt_BR.po for Portugese as spoken in Brazil or fr.po for French as spoken in France. Launchpad only accepts languages that have an ISO 639 code.

The second rule was a problem. PHP looks in the folder `locale/xx_XX/LC_MESSAGES/` for language files and this can’t be changed. Here `locale` is the directory for storing language files, `xx_XX` is the appropriate language code, and `x.mo` is the compiled .po file. At first I put the .po and .mo file of a language in the directory `locale/xx_XX/LC_MESSAGES/`. As a result, Launchpad could find the language files, but could not import them.

After some asking around on the #launchpad IRC channel I finally found the solution. As PHP only requires the compiled language files (*.mo) to be in the `locale/xx_XX/LC_MESSAGES/` directory, I moved the template file (getgnulinux.pot) and all language files (*.po) to a directory `locale/getgnulinux/`. I also changed the PHP code so that the language files are named for the appropriate ISO 639 language code. After these changes, translations would still work (PHP still has access to the .mo files) and Launchpad could now import the translation files because all three rules are met.

Translations with Launchpad

The new translation system has been successfully implemented. Anyone can now
start using Launchpad Translations to help translate the “get GNU/Linux!” website.

I’ve requested the language files in .po gettext format from Olivier Cleynen. Until he sends me the these files the website will only be available in English.

I’m also working on improving the layout of the website (preview). I’m applying some new styles with the use of CSS3. These include web fonts, rounded corners, transition effects and drop shadows. I’ve started working on the headers and on the navigation bar. And because I’m deeply in love with the navigation bar of the new gnome.org website, I’ll probably use that design for the new navigation bar. One major improvement in the headers is that the title text “get GNU/Linux!” – originally part of the blue header image – is now actual text so that the title can be translated as well.

I18n with gettext

The getgnulinux.org website was put for download as an archive containing static HTML pages. The HTML pages were automatically generated from source files and it would help if I had access to those source files, but unfortunately I don’t. Before I can start focusing on implementing the new translation system I need to get rid of those static HTML pages.

So I’ve started to convert all HTML pages to PHP pages. At the same time I was looking around for a translation solution;  that’s when I found GNU gettext. It turns out that PHP has support for GNU `gettext’. This means that translation files (*.po) can easily be extracted from the PHP pages. The translation files can then be translated with translation systems like Pootle or Launchpad Translate (not yet tested), and best of all, the same PHP pages can load the translation files of different languages (all using tools from the same `gettext’ package). I did some quick hacks to test this (I converted all pages to PHP with `gettext’ support), and it works like a charm!

I’ll be working hard on fully implementing `gettext’ support. This means that all English text strings in the PHP files need to be marked as translatable, and this is a lot of work.