== Dev Week -- Intro to translations in Ubuntu -- dpm -- Thu, Aug 30th, 2012 == {{{#!irc [15:31] All right, here I'm back again [15:31] This time with something different [15:32] _____ ____ _ _ _ ____ _ _ _____ ___ ___ _ _ ____ [15:32] |_ _| _ \ / \ | \ | / ___|| | / \|_ _|_ _/ _ \| \ | / ___| [15:32] | | | |_) | / _ \ | \| \___ \| | / _ \ | | | | | | | \| \___ \ [15:32] | | | _ < / ___ \| |\ |___) | |___ / ___ \| | | | |_| | |\ |___) | [15:32] |_| |_| \_\/_/ \_\_| \_|____/|_____/_/ \_\_| |___\___/|_| \_|____/ [15:32] 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. [15:33] 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. [15:33] Let's roll [15:33] [15:33] Integrating Your Package with Launchpad Translations [15:33] ==================================================== [15:34] 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:34] This only essentially applies to packages in the main and restricted repositories (and additionally for the -security, -proposed and -updates pockets). [15:35] Only their translations will be imported into Launchpad and delivered in language packs [15:35] Although we've recently introduced a mechanism to import translations from universe packages for those upstreams that want to use Launchpad [15:36] So here's some background first: [15:36] [15:36] Launchpad Translations [15:36] ---------------------- [15:36] As you might know, in Ubuntu we use our very own translations tool: Launchpad Translations [15:36] 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. [15:37] You can see the Ubuntu translations here: https://translations.launchpad.net/ubuntu [15:37] (you can choose a distro series there, e.g. Quantal to see the stats) [15:37] There you'll see a list of translatable applications and documentation, ordered by priority [15:37] Ubuntu is currently translated in more than 200 languages, with different levels of coverage, and can easily support more. [15:37] Many of those translations are done by upstream translation communities, and they also get imported into Launchpad during package uploads [15:37] [15:37] The Ubuntu Translations Community [15:37] --------------------------------- [15:38] 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. [15:38] 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. [15:38] 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. [15:38] And they just... [15:38] ____ ___ ____ _ __ [15:38] | _ \ / _ \ / ___| |/ / [15:38] | |_) | | | | | | ' / [15:38] | _ <| |_| | |___| . \ [15:38] |_| \_\\___/ \____|_|\_\ [15:38] You can see the full list of Ubuntu translation teams here: [15:39] https://translations.launchpad.net/+groups/ubuntu-translators [15:39] With your translation uploads you'll be enabling them to deliver Ubuntu in hundreds of languages, to many, many people [15:39] So time to feel proud now :) [15:39] [15:39] Language Packs [15:39] -------------- [15:39] In Ubuntu we ship all translations in dedicated .deb packages called language packs [15:39] Packages in main and restricted don't contain translations in the form of .binary mo files themselves [15:40] (.mo files are those that contain the translations in the user system) [15:40] (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) [15:40] They are stripped during the build on the Launchpad buildds and put into the language-pack-* packages instead. [15:40] There is a set of language packs per language [15:40] 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 [15:41] Although this cycle, with KDE being in universe [15:41] we won't have KDE translations in language packs [15:41] 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 [15:42] lifecycle [15:42] [15:42] Translations Import Workflow [15:42] ---------------------------- [15:42] 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. [15:42] TheLordOfTime asked: if KDE translations arent included in language packs, how would KDE users get their localization/translation packs? [15:42] Ah, good question, but don't worry [15:43] They will still be shipped, simply not in language packs [15:44] 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 [15:44] in the case of KDE, translations will simply not be extracted and shipped in the original packages [15:44] so all is good :) [15:44] chilicuil asked: so, may I have translations from programs I've not installed? [15:44] Another good question [15:44] Yeah, that's actually the case [15:45] 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 [15:46] but this just amounts to a bit of extra space, which 99% of users won't even notice or need to worry about [15:46] so where were we? [15:47] Oh, translations being extracted from packages... [15:47] ok, so here's what happens next [15:47] 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. [15:47] If you are interested in seeing what the imports queue looks like, you can see the translation uploads currently pending review here: [15:47] https://translations.launchpad.net/ubuntu/quantal/+imports?field.filter_extension=pot&field.filter_status=NEEDS_REVIEW&start=75&batch=75 [15:48] That's the global imports queue, but you can see it per package as well [15:48] https://translations.launchpad.net/ubuntu/quantal/+source/unity/+imports [15:48] So now we come to the nitty gritty details... :) [15:49] [15:49] Package Modifications for a better Ubuntu integration [15:49] ----------------------------------------------------- [15:49] In order for translations to be imported to Launchpad and in order to direct translators to the translations page to start contributing straight away, [15:49] we make two main changes to the application at the packaging level: [15:49] * 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. [15:49] Actually, I think we can leave it to one change :) [15:49] For those not familiar with the concept of a POT template: [15:49] It's a textual file with the .pot extension [15:50] and it's what Launchpad use as the source for exposing translations [15:50] all translations in all languages will be based on that template, which contains the translatable messages in English [15:50] It's generally built by gettext-based tools [15:50] which extract translatable messages from the code in an application [15:50] and put them in the textual .pot file [15:50] There are 10 minutes remaining in the current session. [15:51] Actually, seeing that there are only 10 mins left, I think I'll wrap it up here and point you to: [15:51] https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Packaging [15:52] There you'll find the information I've been talking on in this session, and more [15:52] As per contributing with translations, the best place to get started is on: [15:52] https://wiki.ubuntu.com/Translation [15:53] Ok, time for some questions, bring them on! :-) [15:54] JoseeAntonioR asked: How can I start a translation team for a language that hasn't been set up yet? [15:54] Aha, nice question! [15:55] You'll find detailed, step-by-step information on how to do that here: https://wiki.ubuntu.com/Translations/KnowledgeBase/StartingTeam [15:55] There are 5 minutes remaining in the current session. [15:57] ok, any other questions, or anything you've always wanted to know about translations and were afraid to ask? [15:57] ...3... [15:58] marcosb asked: shell scripts [15:58] marcosb asked: translation on shell scripts [15:58] ok, let me rephrase that... any _easy_ questions? ;-) [15:59] just joking, but translation of shell scripts is a bit hard to get right [15:59] and not always works fully [15:59] I'd recommend reading the gettext documentation for that, which contains a couple of good examples [16:00] my recommendation is that if you want to make a script translatable, just use Python [16:00] which fully supports gettext [16:00] ok, so time's up! [16:00] Thanks everyone for listening in and I hope you enjoyed the session! }}}