Posts Tagged ‘Ubuntu’

Lost: Minimum Requirements Script

Wednesday, July 29th, 2009

A couple years ago, I remember reading about a script that would scan a source tree and tell you the minimum required version of GTK+ based on the symbols used. I can’t find it anymore. Does anyone know what I’m talking about?

I assume it could be rewritten these days using sexy gobject introspection and thus apply to more than just GTK+. But I’d be happy with the older, basic script.

In exchange for clues about the script, here’s a neat bash tip: I discovered that if you put a space before a command you type on the console, it doesn’t show up in the bash history. It’s not in the output of history and doesn’t show up when you scroll up through your commands with the up arrow.

I’m not sure what the non-malicious uses of that trick are, but there you go.

Translate Your Documentation

Saturday, May 2nd, 2009

As a maintainer, I’ve always been a little sad that my man pages were not translated. Nor where my user help documentation (docbook files). They weren’t translated mainly because:

  • intltool doesn’t support those formats (well, intltool does xml, but not specifically docbook) and
  • the usage is slightly different — help docs need to be generated from po files, but normally those po files are just installed onto the system

Traditionally, projects like GNOME have translators handle docbooks separately from the rest of translations. Partly because of the problems above and partly because docbooks often have images which must be recreated in the correct locale. Gettext just isn’t equipped for that.

But I’m willing to concede the screenshot point. I’m OK with user docs that don’t have screenshots for my simple apps. After all, they’re usually just used to walk through the UI that the user can already see. They don’t generally explain anything.

So, how to integrate documentations to my existing gettext system?

Desired Solution

First, let me briefly review what I want the end product to look like:

  • I don’t want the documentation translations to end up installed on users’ systems in the compiled .mo files. That just wastes lots of space.
  • But I want all the translations to be in the same domain. Multiple domains is a pain for both translators and maintainers. Translators have to go translate two files, not one (I suspect most translators won’t bother-to-translate/notice the other domain), and the domains will have duplicated strings (meaning translators will duplicate work). This means one .pot file and consequently one .po file for each language. This would appear at odds with the previous desire.
  • Man pages and docbook are funky formats. There’s all sorts of syntax that makes breaking the content into logical paragraphs or phrases difficult. I want a tool that can handle that while spitting out gettext files. Intltool’s xml module, for example, doesn’t have enough docbook-specific smarts to make that happen, although it does integrate nicely with gettext.

Enter po4a

There’s a program called po4a that can handle some of the more unusual formats well while consuming po files and generating pot files. It does a really great job, but it has a few shortcomings:

  • it likes to own the .po files
  • it likes to own the .pot file
  • it uses its own list of languages (not po/LINGUAS)

All of those shortcomings will make it hard to have one pot file.

Enter Lots of Makefile Magic

I stole the original bits of Makefile goodness for po4a from dpkg, which used it for its man pages. But I added a bit more to meet my desired goals above.

Basically the sequence is as follows when making a distribution tarball (make dist):

  1. Copy all the .po files from po/ to the help/ directory
  2. Import the contents of po/LINGUAS to po4a’s configuration file in the help directory
  3. Run po4a, generating compiled, translated help documentation from the base versions and the copied po files. This will generate a .pot file.
  4. Filter all the po/*.po files through the standard .pot file, dropping all their help documentation translations. This is so we don’t distribute space-wasting translations that we already ship in the compiled version above.
  5. Merge the generated help .pot file with the standard .pot file in po/ for shipping and distributing to translators.

Ta-da! It’s a bit convoluted, but means that I can have all the benefits of translated help documentation, with none of the disadvantages of multiple .pot files. Of course, I more than doubled my string count, but I assume translators prefer better coverage than not.

The code is mostly in Déjà Dup‘s help/Makefile.am, help/po4a.cfg, and Makefile.am. I encourage you to steal it and use it for your own projects. Too few man pages are translated.

If there are better tools or more elegant methods, I’d love to hear them!

Ubuntu Distribution

Tuesday, April 28th, 2009

When I recently joined the Ubuntu Members team, I was surprised to note the user map:

many flags in North America and Europe, none elsewhere

Seems a bit more concentrated than I expected. I guess the UDS policy of alternating Europe and America locations is more fair than I supposed. (Though in truth, that map suggests it should always be in Europe.)

I know we have rocking LoCo and translation teams pretty much everywhere. As well as developers. Just not many that are both official members and willing to share their latitude and longitude?

Update: So apparently the real map is much more inclusive. The one on the team front page is some optimized subset to make rendering faster. False alarm! Although the algorithm could use tweaking to get a nicer spread.

Turkish Is Crazy

Sunday, April 19th, 2009

So I was working on a very odd bug at work. For some reason, printing didn’t work when you chose Turkish as your language.

After some digging, I discovered that Turkish is very odd in one particular aspect. The wikipedia entry about it can explain better than me, but suffice to say:

$ LANG=en_US.UTF-8 python -c "import locale; locale.setlocale(locale.LC_ALL, ''); print 'TURKISH'.lower()"
turkish
$ LANG=tr_TR.UTF-8 python -c "import locale; locale.setlocale(locale.LC_ALL, ''); print 'TURKISH'.lower()"
turkIsh

This has implications for all sorts of sloppily written code. Normally it works alright, if all you care about is if two strings are the same thing when lower‘ed, but if you are using lower as part of a hash function and then talking over a network, everything will screw up. I’m surprised anything works in Turkish.

I’m an Ubuntu Member!

Wednesday, April 15th, 2009

W00t! I survived the council meeting and am now an official Ubuntu Member! A small step on my way to MOTU.

Dogtail and LDTP

Saturday, March 21st, 2009

So I was looking into an automated test framework for Déjà Dup and naturally, I tried the current contenders: Dogtail and LDTP.

I have to say, I liked Dogtail’s Python interface more, but it kept crashing my at-spi daemon, meaning I had to log out and log back in again. That was enough to keep me disinterested.

So I tried LDTP. It was just fine in terms of robustness (modulo a bug with its UTF-8 support). So I’ve been cooking up a kick-ass test suite framework for Déjà Dup.

The one big problem is that GtkAssistant accessibility support seems broken. It just doesn’t expose the widgets correctly. Which means I can’t automate much of Déjà Dup. Does anyone know atk well? Please fix my bug. :)

Déjà Dup in Ubuntu

Thursday, February 19th, 2009

Woohoo! Déjà Dup squeezed into Ubuntu Jaunty 9.04, just before Feature Freeze.

Still not in Debian (or any other distribution that I know of), but it’s a start.

UDS Debriefing

Wednesday, January 7th, 2009

Phew, I meant to write this a million years ago.

I went to UDS Jaunty, got the shirt, came back. It was at the Googleplex, but seemingly the backwater part of it. The food wasn’t amazing, and we weren’t allowed to really wander around. So it was just a bunch of conference rooms. With weird cameras that would move by themselves and that you couldn’t turn off.

And Mountain View, California is no Prague. There wasn’t much nightlife, and you needed a car to get anywhere. So the locale as a whole was disappointing. Next time, let’s do New Orleans!

It was neat to see how forward-thinking most of the sessions were. I felt like it was more about planning for Jaunty+1 than Jaunty. Really long-term views, with an eye towards what first steps can be done by Jaunty.

I attended the Jaunty Backup session. You can even see the videos from the session, although no one was moving the camera around as people spoke, so I’m perpetually off stage right.

The session was inconclusive, and I fear I spent too much of its time talking about Déjà Dup, but I was there to evangalize I guess. I haven’t heard back, and the spec writeup seems like it’s willing to wait until Jaunty+1, as none of the current solutions are ideal.

Which is good. Throwing Déjà Dup together in time to meet Jaunty deadlines would have been tight. But honestly, I think it’s coming along fantastically. The recently released 5.0 is really hot, and could have served as a decent first draft for Jaunty.

Besides the backup session, I did a lot of work in our secret OEM Services room, and attended the odd session. It was fun.

GTK+ vs Qt

Monday, September 8th, 2008

Right after I started at Canonical, I met Mark Shuttleworth at UDS.

He asked me about Qt vs GTK+, and I nervously said that I preferred the GTK+ stack, finding it more complete. He was surprised, having heard the opposite from others. I recently asked an interviewee about Qt and GTK+, and he also said that he preferred Qt’s abstractions.

Bollucks.

On a widget-level, they’re both about the same. They both have data structure libraries, nice MVC layers, and a similar suite of built-in widgets. Pre-GIO, Qt had a leg up with a file IO abstraction. But that’s about all Qt had.

What GTK+ brings to the table is policy abstraction and system integration. The GTK+ stack gives us icon themes, system tray applets, how to launch files like the system does, printing support, and recently used file support. Qt doesn’t have a compelling answer for the above.

I wish I had said all that when Mark asked. :)

UDS Intrepid

Monday, May 26th, 2008

So, Prague! The UDS itself was good. I mostly listened in on the mobile tracks, as I’m not embedded enough to usefully contribute. But I certainly learned a lot of face/irc-nick pairings.

UDS notes:

  • I liked the decision to move the browser default home page to a simplified layout — much more akin to the default Firefox home page.
  • UME sounds like it will make tentative motions away from the poorly-maintained Hildon framework and toward a GTK+ library that has been patched for mobile-usage (maybe like the Hiker Project) with some Clutter for glam (which is where GNOME seems to be heading as well).
  • The “lower boot time for mobile devices” session was interesting. We got Scott from the kernel team in the room and he proceeded to open a can of whoop ass on the boot time. Using iterations of bootchart on a live piece of hardware, he just pointed at seconds of the timeline and they scurried away. A lot of improvement came from not running modprobe so much, since the hardware is known in advance. Plus, some backporting of boot-time fixes in newer kernels.
  • I thought it was cute that Jono rickrolled the big social gathering at the end.

Prague notes

  • Their toilets are variable-flush, which made sense to me. You just hold it down for as long as you want it to flush. Not all toilet trips are made equal.
  • They seem to like to put some weird vinegary sauce on their corn. Didn’t like that at all.
  • “Nonstop” means “24/7.” This was interesting because you’d see signs like “nonstop karaoke” which sounded like a threat of torture, not an enticement.
  • The hotel bathroom was odd. Not only did they have a dial to turn on muzak at varying volumes, but the shower door didn’t close and only covered half the tub. So you just had to get real close and comfortable in the front, and not splash about. A real cramp in my style.
  • I had absinthe for the first time. I had it straight rather than the complicated water-over-sugar-then-flames bit. It tasted not pleasant, but it did get me reasonably drunk and left a pleasant burning sensation in my throat for a good length of time. Typical liquor experience.
  • The buildings were beautiful. There were details, decorations, and statues adorning every nook and cranny of them.
  • Soda was expensive. 0.2 liters cost as much as 0.5 liters of beer. You couldn’t just get tap water either. You had to order “still water” (differentiated from “water with gas”).
  • I really, really liked what seemed to be a standard feature on Czech (European?) menus: every item had a measurement for it. Food items would say “200g” or “300g” depending on how big the portion was. Drinks would say “0.5l” or “0.1l” (for shots, say). It was a great help in figuring out how much food came with each plate, especially when reading translated menus.
  • They used metric and 24-hour clocks. It was awesome.