Locale kit : building a preflet

Blog post by PulkoMandy on Sun, 2009-08-09 22:15

The end of GSoC is in less than two weeks now, so it's time to clean things up and get what I started working. I spent the previous week reading ICU documentation to understand how it worked, and this week I used this information to build the locale preflet.

This is not as simple as it looks. First, I had no experience of programming with the Interface kit so I had to learn how things worked. I also had to modify some of the Locale Kit API to be able to actually change some things that were read-only. Finally, the preflet is also the first application using the date and time formatting part of the locale kit, which was not written yet. I had to both make the API work and make it configurable.

To do that I decided to call ICU directly in the preference panel, bypassing the usual API provided by the locale kit. This will be cleaned up later.

I'm still messing with the layout manager to get things looking right. Designing and coding UIs is not my favorite activity, I prefer messing with the internal of the system.

To design this panel I took inspiration from other OS, most notably Geoworks Ensemble (an old GUI from the ms-dos times) and Mac Os X.

International settings of some other OS

These use roughly the same system, a mix of dropdown menus and text fields, to allow the user to do almost anything with the date format, while still being readable. Windows allow only to enter a string using special chars such as Y for year. While this would have been simpler to code (ICU use such strings internally), I find it much less useable. My preflet also provide a realtime updated example of the current settings. The code is far from complete, for now it's only possible to select one of the default settings in the listview. The dropdowns are not filled in with the format info. The examples are working fine.

The other tab of the preflet is fully finished however. It allows you to select the preferred languages for localisation of texts. It's very simple, with only two lists and you can drag and drop languages between them to enable or disable them. You can also drag languages up and down to sort them by order of preference.

Locale preflet prototypeLocale preflet prototype

I'm tired of messing with scrollviews, tabviews and grouplayoutbuilders, so I will focus on the string parsing part and let the interface cleanup for later. I'd like to at least finish GSoC with something useable, even if not perfect, than a good-looking window that is useless.