Lars Wirzenius: May, 2007
- May 28: Static website, with translations, using IkiWiki
- May 09: Blinkenlites und cursorblinken
- May 06: Free Thursday on May 10 at Teerenpeli, Helsinki
Monday, May 28, 2007
One of my current projects involves setting up a website that is translated to at least two languages. For various reasons I wanted to use IkiWiki as the backend, even though the site is static, and does not need the wiki functionality. IkiWiki is, in principle, a wiki engine, but with a difference: it is run off-line, and creates a set of static HTML pages, rather than running every time a page is accessed. This makes it suitable for static websites.
For the translation, I wanted to have the following
setup: Each page is available in each language, so the pages
are named foo.xx.html, with xx being the
ISO language code. This also allows HTTP content negotiation
to work, if the client asks for the page without the
IkiWiki itself does not currently have support for
translations. Doing translations by manually editing each
page in each language is tiresome and error prone. I wanted
to use the
gettext approach, where the translations
are maintained using
.po files. The
po4a tool makes this possible: it supports
many file formats.
English is declared as the original language for this project: all other languages are generated via po4a from the English ones. The page content gets put into foo.xx.mdwn. po4a generates all other language files than English, and these are then fed as input to IkiWiki, which generates the HTML.
In summary and horrible ad hoc pseudo-notation:
- po4a: foo.en.mdwn -> foo.pot
- cp: foo.pot -> foo.xx.po
- $EDITOR: update translation in foo.xx.po
- po4a: foo.en.mdwn + foo.xx.po -> foo.xx.mdwn
- IkiWiki: foo.*.mdwn -> foo.*.html
This works pretty well, but only for the part of the page that gets put into the content section in the IkiWiki page template (<TMPL_VAR CONTENT>). The page design we have calls for a couple of elements with translatable content outside the content: a logo and a menu/navigation bar. To deal with these, I made a little IkiWiki plugin.
The plugin sets a couple of Perl
BASENAME, based on the input file name. If the
input name is foo.en.mdwn, the variable get set to
foo, respectively. The
IkiWiki page template then uses the variables to load the
right logo for the language of the page being generated.
The navigation bar needs further work. Unfortunately, the po4a tools have trouble with the IkiWiki page templates, and can't extract just the menu entries. I ended up doing the navigation bar translation directly in the page template, since it is only a few words anyway.
<li><a href="index.<TMPL_VAR LANG>.html">
The "this page in other languages" part of the navigation part looks like this:
<li><a href="<TMPL_VAR BASENAME>.fi.html">suomeksi</a></li>
I made the plugin (my first Perl ever!) available in case anyone else finds it useful.
Note that the plugin isn't of much help if you want to maintain a translated wiki, since this all need some Makefile magic to make things smooth. I'm not sure the Makefile is at all optimal, though.
We haven't yet gone public with the website, so this setup of mine may well get improvements still.
Wednesday, May 09, 2007
While cleaning up the infinite mess that is my home directory, I found the following:
ACHTUNG! ALLES LOOKENSPEEPERS!
Das Internet is nicht fuer gefingerclicken und giffengrabben. Ist easy droppenpacket der routers und overloaden der backbone mit der spammen unt der me-tooen. Ist nicht fuer gewerken bei das dumpkopfen. Das musclicken sichtseeren keepen das bandwit-spewin hans in das pockets muss; relaxen und watchen das cursorblinken.
This is, obviously, a play on the old blinkenlite thing, which I also found:
A C H T U N G ! ! !
--Alles Touristen und Non Technischen Lookens Peepers--
Das maschine control is nicht fur Gefingerpoken und Mittengrabben. Oderwise is easy schnappen der Schpriggenwerk, Blownfuse, und Poppencorken mit Spitzensparken. Der Maschine is Diggen by Experten only. Is nicht fur Geverken by das Dummkopfen. Das Rubbernecken und Sightseeren keepen das Cottonpicken Hands in das Pockets. So Relaxen und Watsch das Blinkenlite.
If I ever have an actual machine room, these will go on the wall.
Sunday, May 06, 2007
Open Tuesday is an attempt to build a regular meeting place for people interested in free software (open source), both technical and business people. The goal is to have an event the first Tuesday every month, and some company or another sponsors it by picking up the bar tab.
It's fun. You meet people, and can chat about various things.
Unfortunately, it isn't quite regular enough, and the website and mailing list aren't updated reliably enough, or early enough, that an event is happening. It is now Sunday evening, and I still don't know there's an event the day after tomorrow. There doesn't seem to have been one last Tuesday, which is sensible, since the first of May is a big hangover day in Finland; it's also an official holiday.
Since it's fun to meet people like that, I am going to see if I can't get a "Free Thursday" event going. This is partly in competition with Open Tuesday, but a friendly kind of competition. I hope Open Tuesday will continue, since it's a different kind of event from Free Thursday.
Free Thursday is simply people who want to have a drink with each other. No sponsors, no organization, no prepared talks, no web forums, no web site, just show up and have a good time. You'll have to pay for your own drinks.
Free Thursday will happen the second Thursday each month at 18:00. The first event will be Thusday, May 10, at the Teerenpeli bar in Kamppi, Helsinki.
In case people want to discuss or announce anything
related to Free Thursday, I've set up a mailing list. E-mail
subscribe, and check the
archives if you're not a subscriber. Posting is free to
subscribers, everyone else gets moderated; this is for
preventing spam, all non-spam will be allowed through.
Please come, and please spread the word.
Now, if someone will start a "Net Wednesday" event, all will be perfect.