LaunchpadTranslationsUnderTheHood

Differences between revisions 2 and 3
Revision 2 as of 2010-01-20 09:59:17
Size: 1795
Editor: g230195187
Comment:
Revision 3 as of 2010-01-20 12:24:37
Size: 3465
Editor: g230195187
Comment:
Deletions are marked like this. Additions are marked like this.
Line 27: Line 27:
The session text will be archived on the Launchpad development wiki so this is a change for us to gather input for the developer documentation. The session text will be used as developer documentation on the Launchpad development wiki so this is a change for us to gather input from the community.
Line 31: Line 31:
Today we want to help you understand the inner workings of the Launchpad Translations application (Rosetta) and take you for a walk through the source code. We hope that this will enable you to scratch your own itches you have about Rosetta and to contribute to its source.

== Gettext basics ==

You need to understand how gettext ist used to internationalize computer software. You should be familiar [[http://www.gnu.org/software/gettext/manual/gettext.html|gettext documenation]] but we will give you a short run-through of those parts that are important for Rosetta.

=== PO files ===

Gettext stores translations in so-called ''portable object'' files, abbriviated as PO files. They contain data sets of ''msgid'' and ''msgstr'', the former containing the English orignal string, the latter containing the translation of that string. They may be prepended by special comments that convey information about the string that is being translated, like in which source file it was found. Here is an example:

{{{
#: src/coding.c:123
msgid "Thank you"
msgstr "Merci"
}}}

Gettext states that ''msgid'' could be anything to indentify the string in the source code and not necessarily the English original string. Using the full English original string as the msgid, though, has proven to be the most convenient way to work on translations and is the only form that is fully supported by Rosetta.



=== Translation templates ===

When translatable strings are extracted from source code using xgettext or intltool, they are put into a file which is commonly referred to as the translation template. The format is machine independent,
 

UbuntuDeveloperWeek session

by AdiRoiban and HenningEggers on Tuesday, 20 Jan 2010, 17h

Intended audience

  • Developers wanting to contribute to Launchpad Translations but are not yet familiar with the internal structure of the application.
  • Interested maintainers of translations in Launchpad and translators that want to have a better understanding of how and why Launchpad Translations does what it does.

Required knowledge

  • GNU gettext system for internationalization of software
  • Python coding
  • A general understanding of how a web application works
  • Knowledge of zope is not required but a bonus

Goals of the session

Session attendees have a good understanding of

  • how translation data is stored in LP translation (db schema)
  • how the import and approval process works (translationimportqueue)
  • how permissions and translation groups work (translation groups)
  • how review and suggestion handling works (POFile:+translate)

It is not the goal of this session to introduce the attendees to Launchpad development in general. That will be covered in a different session by Karl Fogel

The session text will be used as developer documentation on the Launchpad development wiki so this is a change for us to gather input from the community.

Session text

Today we want to help you understand the inner workings of the Launchpad Translations application (Rosetta) and take you for a walk through the source code. We hope that this will enable you to scratch your own itches you have about Rosetta and to contribute to its source.

Gettext basics

You need to understand how gettext ist used to internationalize computer software. You should be familiar gettext documenation but we will give you a short run-through of those parts that are important for Rosetta.

PO files

Gettext stores translations in so-called portable object files, abbriviated as PO files. They contain data sets of msgid and msgstr, the former containing the English orignal string, the latter containing the translation of that string. They may be prepended by special comments that convey information about the string that is being translated, like in which source file it was found. Here is an example:

#: src/coding.c:123
msgid "Thank you"
msgstr "Merci"

Gettext states that msgid could be anything to indentify the string in the source code and not necessarily the English original string. Using the full English original string as the msgid, though, has proven to be the most convenient way to work on translations and is the only form that is fully supported by Rosetta.

Translation templates

When translatable strings are extracted from source code using xgettext or intltool, they are put into a file which is commonly referred to as the translation template. The format is machine independent,

  1. What are PO files, PO Templates, message ids and message strings? (short review of the gettext system)

  2. How this has been mapped to the db schema. (jtv's great schema diagram goes here.)
  3. ...

Hands-on development

Since it is not expected that many of the attendees have a ready-to-use LP development setup, this will have to be a prepared example of fixing a small bug in LP translations that gets presented in some way. Suggestions?

UbuntuDeveloperWeek/Sessions/LaunchpadTranslationsUnderTheHood (last edited 2010-01-27 17:06:58 by h194-54-129-79)