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.

Comments

Re: Locale kit : building a preflet

Lookin' good!

I really need to DL and try Haiku again, to compare and contrast it with the original. Were there a PPC version, I'd try it on my BeBox. :)

Likely to be completely unrelated to your efforts, but I must ask: what are the gazitzas in the horizontal (separator) rules (date, time and number) in the screenshot image?

Re: Locale kit : building a preflet

I used a new interface kit object to draw these separators and it look like the drawing code is not prefect. But maybe it is my fault, because the scrollbar is buggy too.

Re: Locale kit : building a preflet

This is excellent! I agree that usable API is more important right now than all the GUI details. However, given the amount of stuff involved, I think you've done just fine.

I'm curious if this includes postal addresses and telephone numbers too? Those two specifically can be real problems.

Re: Locale kit : building a preflet

There is no plan for including postal addresses and phone numbers right now. But it might be a future extension of the locale kit.

Re: Locale kit : building a preflet

Hopefully darkwyrm's GUI builder will arrive someday and rescue you from your little torture chamber with a BView. :)

Have a look at the Time preferences. Filtering regions with a drop-down menu is a good way to make an alphabetical list less confusing. And man, our arabic friends surely need to agree to some intra-arabic standard, eh? :)

Re: Locale kit : building a preflet

The plan is to use a BOutlineListView to clear things up. But this is part of the GUI cleanup, I want to get the basic things working first. And replacing a ListView with an OutlineListView is not too complex.

Re: Locale kit : building a preflet

It would be convenient to add also "First day of week" setting to the time format preflet. It's not everywhere Monday.

Re: Locale kit : building a preflet

Yes, and I also saw one preflet on the page I mentionned allowed to set which days are workdays.
These can be added later, I'm now working on trying to get a first useable version.

Re: Locale kit : building a preflet

Well technically Sunday and Saturday are weekends and if you think about it Sunday is the beginning end and Saturday is the tail end that's how I see it anyway. Some people (myself included) have religious reasons for putting Sunday first it being the Lord's day.

So yeah a preference to get my calendars right would be sweet :-)

Re: Locale kit : building a preflet

In many places, Sunday is the first day, in many others, Monday is the first day, and in (apparently) Swahili, it's Saturday.

Go figure :)

Re: Locale kit : building a preflet

cb88 wrote:

Well technically Sunday and Saturday are weekends and if you think about it Sunday is the beginning end and Saturday is the tail end that's how I see it anyway.

Where I'm currently working (Saudi Arabia) the weekend is Thursday/Friday which means the start of the week is Saturday, so some sort of option would be useful.

Re: Locale kit : building a preflet

At the University of Cambridge, weeks start on a Thursday and finish on Wednesday; but we still have a weekend in the middle at the standard UK time! I guess they just wanted to be a bit different...

Btw, good progress on the GSOC. I haven't been following Haiku closely recently but should update my Haiku install and see what's changed.

Simon