IntroToUbuntuTranslations

Dev Week -- Intro to translations in Ubuntu -- dpm -- Thu, Aug 30th, 2012

   1 [15:31] <dpm>   All right, here I'm back again
   2 [15:31] <dpm>   This time with something different
   3 [15:32] <dpm>    _____ ____      _    _   _ ____  _        _  _____ ___ ___  _   _ ____
   4 [15:32] <dpm>   |_   _|  _ \    / \  | \ | / ___|| |      / \|_   _|_ _/ _ \| \ | / ___|
   5 [15:32] <dpm>     | | | |_) |  / _ \ |  \| \___ \| |     / _ \ | |  | | | | |  \| \___ \
   6 [15:32] <dpm>     | | |  _ <  / ___ \| |\  |___) | |___ / ___ \| |  | | |_| | |\  |___) |
   7 [15:32] <dpm>     |_| |_| \_\/_/   \_\_| \_|____/|_____/_/   \_\_| |___\___/|_| \_|____/
   8 [15:32] <dpm>   I'm David Planella, from the Community team at Canonical, this time with my hat as the Ubuntu Translations Coordinator to make sure, with the help of our awesome translations community, that Ubuntu rocks equally hard in every language.
   9 [15:33] <dpm>   Today I'd like to get a bit more technical and explain how you can make sure your package is well integrated with the Launchpad Translations web app, so that Ubuntu translators can happily do their work and provide a well localized OS to our users.
  10 [15:33] <dpm>   Let's roll
  11 [15:33] <dpm>    
  12 [15:33] <dpm>   Integrating Your Package with Launchpad Translations
  13 [15:33] <dpm>   ====================================================
  14 [15:34] <dpm>   So again, the idea of this talk is to give you an overview of what is needed in your package to play well with Launchpad and for their translations to be exposed to translators there.
  15 [15:34] <dpm>   This only essentially applies to packages in the main and restricted repositories (and additionally for the -security, -proposed and -updates pockets).
  16 [15:35] <dpm>   Only their translations will be imported into Launchpad and delivered in language packs
  17 [15:35] <dpm>   Although we've recently introduced a mechanism to import translations from universe packages for those upstreams that want to use Launchpad
  18 [15:36] <dpm>   So here's some background first:
  19 [15:36] <dpm>    
  20 [15:36] <dpm>   Launchpad Translations
  21 [15:36] <dpm>   ----------------------
  22 [15:36] <dpm>   As you might know, in Ubuntu we use our very own translations tool: Launchpad Translations
  23 [15:36] <dpm>   Launchpad Translations allows distributed translation of our Operating System, by a large number of volunteer contributors, who work hard to ensure Ubuntu is well localized for everyone to use it in their own language.
  24 [15:37] <dpm>   You can see the Ubuntu translations here: https://translations.launchpad.net/ubuntu
  25 [15:37] <dpm>   (you can choose a distro series there, e.g. Quantal to see the stats)
  26 [15:37] <dpm>   There you'll see a list of translatable applications and documentation, ordered by priority
  27 [15:37] <dpm>   Ubuntu is currently translated in more than 200 languages, with different levels of coverage, and can easily support more.
  28 [15:37] <dpm>   Many of those translations are done by upstream translation communities, and they also get imported into Launchpad during package uploads
  29 [15:37] <dpm>    
  30 [15:37] <dpm>   The Ubuntu Translations Community
  31 [15:37] <dpm>   ---------------------------------
  32 [15:38] <dpm>   I won't dwell too much on this subject, as I think as a packager you might be more focused on the technical side of things.
  33 [15:38] <dpm>   Nevertheless, I'd like to add a few words about the Ubuntu Translations community, since I think, be it for the subject of this talk, or be it because we are all part of the bigger Ubuntu family, it is important for those working directly or indirectly with translations to know more about it.
  34 [15:38] <dpm>   Ubuntu Translators are a vast number of volunteers who organise themselves in translation teams, appointed to be responsible for the translation of a given language.
  35 [15:38] <dpm>   And they just...
  36 [15:38] <dpm>    ____   ___   ____ _  __
  37 [15:38] <dpm>   |  _ \ / _ \ / ___| |/ /
  38 [15:38] <dpm>   | |_) | | | | |   | ' /
  39 [15:38] <dpm>   |  _ <| |_| | |___| . \
  40 [15:38] <dpm>   |_| \_\\___/ \____|_|\_\
  41 [15:38] <dpm>   You can see the full list of Ubuntu translation teams here:
  42 [15:39] <dpm>   https://translations.launchpad.net/+groups/ubuntu-translators
  43 [15:39] <dpm>   With your translation uploads you'll be enabling them to deliver Ubuntu in hundreds of languages, to many, many people
  44 [15:39] <dpm>   So time to feel proud now :)
  45 [15:39] <dpm>    
  46 [15:39] <dpm>   Language Packs
  47 [15:39] <dpm>   --------------
  48 [15:39] <dpm>   In Ubuntu we ship all translations in dedicated .deb packages called language packs
  49 [15:39] <dpm>   Packages in main and restricted don't contain translations in the form of .binary mo files themselves
  50 [15:40] <dpm>   (.mo files are those that contain the translations in the user system)
  51 [15:40] <dpm>   (if you are not familiar with them, .mo files are a type of binary files where translations are loaded from at runtime. The source for translations are textual .po files that get compiled into the final .mo files)
  52 [15:40] <dpm> They are stripped during the build on the Launchpad buildds and put into the language-pack-* packages instead.
  53 [15:40] <dpm> There is a set of language packs per language
  54 [15:40] <dpm> They are divided roughly between generic translations and those which are used in a GNOME-based desktop and those used in a KDE-based desktop
  55 [15:41] <dpm> Although this cycle, with KDE being in universe
  56 [15:41] <dpm> we won't have KDE translations in language packs
  57 [15:41] <dpm> We essentially make use of language packs to deliver translations independently from applications and thus we're able to ship regular translation updates throughout a distro
  58 [15:42] <dpm> lifecycle
  59 [15:42] <dpm>  
  60 [15:42] <dpm> Translations Import Workflow
  61 [15:42] <dpm> ----------------------------
  62 [15:42] <dpm> On a 1000 feet view, what happens when you do a package upload is that their translations get stripped by a tool called pkgbinarymangler, and they are put in a translations tarball containing a translations template (more on this later on) and the translations themselves.
  63 [15:42] <ClassBot> TheLordOfTime asked: if KDE translations arent included in language packs, how would KDE users get their localization/translation packs?
  64 [15:42] <dpm> Ah, good question, but don't worry
  65 [15:43] <dpm> They will still be shipped, simply not in language packs
  66 [15:44] <dpm> what we do in language packs is to extract translations from the original packages, combine them with those from launchpad, and ship them separately in the actual language pack packages
  67 [15:44] <dpm> in the case of KDE, translations will simply not be extracted and shipped in the original packages
  68 [15:44] <dpm> so all is good :)
  69 [15:44] <ClassBot> chilicuil asked: so, may I have translations from programs I've not installed?
  70 [15:44] <dpm> Another good question
  71 [15:44] <dpm> Yeah, that's actually the case
  72 [15:45] <dpm> We put translations for all translatable software from main, restricted, universe in the langpacks, and you'll get them even if you haven't installed the software
  73 [15:46] <dpm> but this just amounts to a bit of extra space, which 99% of users won't even notice or need to worry about
  74 [15:46] <dpm> so where were we?
  75 [15:47] <dpm> Oh, translations being extracted from packages...
  76 [15:47] <dpm> ok, so here's what happens next
  77 [15:47] <dpm> This tarball with extracted translations is then fed to Soyuz (an internal Launchpad component), which ends up handing it to the translations imports queue. There, they will be eventually processed, approved and imported into Launchpad, at which point they will be exposed in the translations web interface ready for translators to do their job.
  78 [15:47] <dpm> If you are interested in seeing what the imports queue looks like, you can see the translation uploads currently pending review here:
  79 [15:47] <dpm> https://translations.launchpad.net/ubuntu/quantal/+imports?field.filter_extension=pot&field.filter_status=NEEDS_REVIEW&start=75&batch=75
  80 [15:48] <dpm> That's the global imports queue, but you can see it per package as well
  81 [15:48] <dpm> https://translations.launchpad.net/ubuntu/quantal/+source/unity/+imports
  82 [15:48] <dpm> So now we come to the nitty gritty details... :)
  83 [15:49] <dpm>  
  84 [15:49] <dpm> Package Modifications for a better Ubuntu integration
  85 [15:49] <dpm> -----------------------------------------------------
  86 [15:49] <dpm> In order for translations to be imported to Launchpad and in order to direct translators to the translations page to start contributing straight away,
  87 [15:49] <dpm> we make two main changes to the application at the packaging level:
  88 [15:49] <dpm> * Creation of a POT file on build - We require the .deb package to produce a .pot translation template during the build, which will be imported into Launchpad and be used to expose translations for translators to do their work.
  89 [15:49] <dpm> Actually, I think we can leave it to one change :)
  90 [15:49] <dpm> For those not familiar with the concept of a POT template:
  91 [15:49] <dpm> It's a textual file with the .pot extension
  92 [15:50] <dpm> and it's what Launchpad use as the source for exposing translations
  93 [15:50] <dpm> all translations in all languages will be based on that template, which contains the translatable messages in English
  94 [15:50] <dpm> It's generally built by gettext-based tools
  95 [15:50] <dpm> which extract translatable messages from the code in an application
  96 [15:50] <dpm> and put them in the textual .pot file
  97 [15:50] <ClassBot> There are 10 minutes remaining in the current session.
  98 [15:51] <dpm> Actually, seeing that there are only 10 mins left, I think I'll wrap it up here and point you to:
  99 [15:51] <dpm>     https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Packaging
 100 [15:52] <dpm> There you'll find the information I've been talking on in this session, and more
 101 [15:52] <dpm> As per contributing with translations, the best place to get started is on:
 102 [15:52] <dpm>     https://wiki.ubuntu.com/Translation
 103 [15:53] <dpm> Ok, time for some questions, bring them on! :-)
 104 [15:54] <ClassBot> JoseeAntonioR asked: How can I start a translation team for a language that hasn't been set up yet?
 105 [15:54] <dpm> Aha, nice question!
 106 [15:55] <dpm> You'll find detailed, step-by-step information on how to do that here: https://wiki.ubuntu.com/Translations/KnowledgeBase/StartingTeam
 107 [15:55] <ClassBot> There are 5 minutes remaining in the current session.
 108 [15:57] <dpm> ok, any other questions, or anything you've always wanted to know about translations and were afraid to ask?
 109 [15:57] <dpm> ...3...
 110 [15:58] <ClassBot> marcosb asked: shell scripts
 111 [15:58] <ClassBot> marcosb asked: translation on shell scripts
 112 [15:58] <dpm> ok, let me rephrase that... any _easy_ questions? ;-)
 113 [15:59] <dpm> just joking, but translation of shell scripts is a bit hard to get right
 114 [15:59] <dpm> and not always works fully
 115 [15:59] <dpm> I'd recommend reading the gettext documentation for that, which contains a couple of good examples
 116 [16:00] <dpm> my recommendation is that if you want to make a script translatable, just use Python
 117 [16:00] <dpm> which fully supports gettext
 118 [16:00] <dpm> ok, so time's up!
 119 [16:00] <dpm> Thanks everyone for listening in and I hope you enjoyed the session!

MeetingLogs/devweek1208/IntroToUbuntuTranslations (last edited 2012-08-31 14:13:51 by jose)