2009
09.09

I use F-Spot to manage my Photo collection, I don’t use F-Spot fully, I just use it mostly as a DAM… One of F-Spot’s nice features is it’s built in support of versioning, so you can have multiple versions of the same picture, without it being presented as seperate files. In F-Spot it’s just one shot, with multiple versions. However, by default, F-Spot uses a naming scheme, that includes spaces and braces, which I consider to be ugly… It makes things difficult (escaping the spaces and such) whenever you want to do things using your commandline…

I especially have this with the “Develop in UFRaw” extension, which produces files like so:

  • IMG_1234.CR2 to IMG_1234 (Developed in UFRaw).jpg

However in the latest version of F-Spot (0.6.1.1), which is being included in Ubuntu Karmic, the string is resolved using a internationalization catalog. In other words, gettext is getting jiggy with it.

So we can edit an existing .po translation file, or in my case, I want to stick with my en_US locale. And there’s no en_US.po file yet. If no such file exists, or a lookup fails, gettext just defaults to the actual string included in the application binary. So we can create a really brief en_US.po file:

msgid "Developed in UFRaw"
msgid_plural "Developed in UFRaw ({0})"
msgstr[0] "_ufraw"
msgstr[1] "_ufraw_{0}"

Next compile this .po file to a binary .mo file, and place that file in the correct location:

sudo msgfmt en_US.po -o /usr/share/locale-langpack/en_US/f-spot.mo

Once this has been done, restart F-Spot, and you’ll notice F-Spot’s behaviour has changed:

  • IMG_1234.CR2 to IMG_1234_ufraw.jpg

Which is much nicer. Please do note, that this is just a hack. Gettext was never intended to be used like this. For example whever you upgrade your F-Spot package, a new “translation” might be included which overwrites and disables this hack. And of course this hack is obviously locale specific.

Update: I screwed up on this one… Since the actual resulting filename becomes IMG_1234 (_ufraw).jpg in actual reality. This happens because the parenthesis aren’t included in the catalog lookup. Silly me.

No Comment.

Add Your Comment

Comments are closed.