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.
Locale Kit Interfacing with ICU
This week two important things happened for my GSoC project: I got commit access to Haiku and I finished working on the catalog part. This mean I can now work more efficiently without having to send my patches trough the GSoC mailing list (you may have noticed I still need my code to be reviewed, however :/).
The catalogs allow strings in an application to be translated. At a first glance you may think this is the only needed thing in a Locale Kit and my work is finished, but it is not the case. The first missing part is the preflet allowing you to select your favorite language. The locale kit will now always try French, if not found default to German, then finally to English. I think this is not the setup most of you want to use.
This week I was at the RMLL in Nantes, and I was busy showing Haiku to other people and explaining them why it was so much better than linux. I had little time for GSoC coding.
Still, I made some cleanup and fixed some small bugs. The catalog part of the locale kit is now working fine and can be used to internationalize applications.
Here is a small guide for those who want to get an application speaking in their own language.
You have to alter your source code to get it working. We've tried to make this need as little changes as possible. First, you have to #include two files : Catalog.h and Locale.h. They are system headers from the locale kit. Now you have to tell the locale kit to initialize a catalog for you. A catalog is a class that you will use to map strings to their translated equivalents. The locale kit will automatically find the right data files for you, depending on the system-wide language preferences, you application mime signature, and some other magic (see the part of this post about the build system changes). So, you only have to add two lines of code:
This week i’ve been working on a big red post-it that was on last week’s picture. It was about wo things : make the catalog handling tools work as build tools, and test them in some special cases.
The first part took me almost the whole week. I started doing a full port of the locale kit, but noticed it would probably be too complex to do that. Instead, I started over with a simpler solution.
almost-UML diagram of the locale kit
This week, I finally got the plaintext catalog add on working. Then today, Oliver reviewed my work and we had a meeting on IRC. We agreed on some changes to the internal architecture of the locale kit, and also to the classes I added. Some classes in this kit have unappropriate names, and the kit was designed with zeta compatibility in mind, whereas in today’s Be-World it seems more important to focus on gettext.
Mid-term evaluations for GSoC are already coming…
I’m still working on the catalogs for translating applications. I got the system working and integrated it into Haiku, so now any application can be translated. However, there is still a lot of work to do. I’m now working on a plaintext catalog add on.
Catalogs are the files that store translated strings. There is a catalog add-on called “default” that is used in applications.
Today I have started to write a catalog add-on to save catalogs in plain text for easy translation. I’ve spent some time looking at the involved C++ classes, and here is what I found.
A catalog is a collection of strings, stored as pairs. It is used in the locale kit to translate the text in an application to the system language at runtime. When an application starts, it asks the locale roster to find its catalog and return it back.
These two weeks I’ve been quite busy with other things, so the project didn’t move as much as I wanted. However, I managed to get the catalog engine to internationalize an app for the first time. It’s not a big application, just a very simple Hello World test program. And the lack of a tool for translating catalogs means I had to edit them by hand to get the translation done.
The work on the Locale Kit as part of the Summer of Code has already started :) This week we have been working on proper integration of my work in the Haiku tree. So you can now checkout Haiku from svn and get the Locale Kit as part of it. Of course, some parts are still broken (or not yet written), but some of the tests seems to be already working.
Hello world ! As you know, I am one of the selected students for this year summer of code. In this post I will introduce myself and give some details about my project.
My name is Adrien Destugues, some of you may know me as PulkoMandy as i’ve been lurking on the irc channel and mailing lists for some time. I already applied for the Summer of Code and Haiku Code Drive last year but unfortunately I was not selected.