Repo Spotlight:

Addlocale and GetOpenOffice

by pinoc

packages cartoon

One of the more recent additions to PCLinuxOS is a script called addlocale (AL). This addition provides a user-friendly interface to add one of 72 non-English locales in PCLinuxOS allowing international users to quickly set up PCLinuxOS in their native language. Work on AL also gave birth to the script GetOpenOffice (GOO), a quick and easy way to upgrade to or install the most recent version of OpenOffice in PCLinuxOS. Now that we know what AL and GOO are about, let's go back in time and see how all this came to life.

Addlocale, a long story...

KDE is the best desktop environment ever, full stop. Huh? Now what has that got to do with AL? Well, a lot. As a long-term Linux evangelist and diehard KDE-fan I finally found the by far best KDE-implementation in PCLinuxOS. That was about 2 years ago but is still true today.

I promoted PCLinuxOS wherever I could, to my parents in Germany and friends and colleagues here in Italy. They all loved the look and feel and the ease of use of PCLinuxOS, but at the end of the day, they did not use it because it was not in their native language. PCLinuxOS was English only, and other distros were multi-lingual.

This was an obvious problem for the promotion of PCLinuxOS into the non-English speaking world. The only way to help my friends adopting the best Linux distro was to figure out how to get PCLinuxOS in Italian. So, off we go, browsing the PCLinuxOS and other forums, digging into all kind of KDE components and documents, the joy of learning by doing, and finally it worked!

Besides adding the new locale settings to the system, you also had to reinstall existing applications to make them appear in the new locale. The necessary steps were summarized in the July 2008 edition of this magazine and can be considered as AL version 0, the "sledgehammer solution" because the entire system is reinstalled, later called REINSTALL-mode.

In the following months, I converted several English installs into Italian using this methodology. Then I thought to automatize these tedious steps and wrapping them up in a user-friendly script. This would allow anybody to easily apply these steps without the need of having to know the details under the hood. Since a new locale is only added to the existing English locale, I called the script addlocale.

After reading and learning a lot about the internal settings and functioning of my beloved desktop environment, AL finally worked for Italian. The next obvious but challenging step was to generalize this script for other locales, first 6, then 20, and finally all 73 KDE3-i18n languages were included. The initial idea was to have AL working for the applications on the 2009.1 CD.

To have an acceptable performance and avoid the rather time-consuming complete system reinstall, I focused only on what I believed to be "essential applications." Most KDE applications worked, but I missed a lot of GTK applications. The number of detected translatable applications constantly increased and now also targeted applications which were not on the 2009.1 CD. Yet, I never knew how to get a complete list of translatable applications for a given locale. This continued up to version 1.6.

Then I finally understood that the translation-relevant information is contained in so-called mo-files, which gets added to the system for the chosen locale during the re-installation of a given application. I wrote a separate script which browses the entire PCLinuxOS repo (14GB), searches each rpm for mo-files, and, for each locale, builds a complete list of all translatable applications. These lists were integrated into version 1.7, the system RPMs are compared against this list, and only those applications having a mo-file for the new locale will be reinstalled.

AL 1.7 was completely redesigned into a new modular structure: Part 1 is generic and adds locale specific extra packages like fonts to the system. Part 2 deals with the mo-files which are extracted during reinstalling the locale-specific rpms. The new modular structure in AL 1.7 had the additional advantage to group the window manager specific settings into a separate section and, as a result, AL could now be extended to non-KDE window managers such as Gnome, LXDE, etc.

FAST-mode and foreign translations...

The next major change came with AL 2.0. Only now I realized that the time-consuming and tedious rpm-reinstall in Part 2 could be replaced by simply extracting a pre-build archive of locale-specific mo-files into the respective locale directory. I modified my separate script to first, build a new database of extracted locale-specific mo-files using the information of the entire repo, and second, pack the mo-files into locale-specific archives. AL 2.0 just downloaded and extracted such a mo-file archive into the system.

This new approach, called FAST-mode, replaced the time-consuming download and reinstall of typically 500 MB of RPMs by a small download of ~ 10 MB, shortening the entire reinstall process in Part 2 from a about 20 minutes to 2 seconds, not to mention the gain in the download time.

Another big advantage of using a pre-compiled mo-database was the ability to utilize translations of other Linux distributions. For example: the PCLinuxOS RPM for the application Synaptic does not have a Swedish mo-file, so reinstalling Synaptic in a Swedish locale can not provide a Swedish translation for Synaptic; instead Synaptic will remain in English. Yet, in a Swedish Ubuntu installation, Synaptic is in Swedish.

Investigating the Ubuntu deb-package for Synaptic, I found the Swedish mo-file, copied it from a Swedish Ubuntu install to my Swedish PCLinuxOS test machine in /usr/share/locale/sv/LC_MESSAGES/, relaunched Synaptic, and, surprise, Synaptic was in Swedish!

pic1

addlocale: PCLinuxOS Gnome, Swedish

pic2

addlocale: PCLinuxOS KDE, Arabic

The obvious next step was to yet again modify my separate script with the added feature to scan all Ubuntu deb-files for mo-files not present in PCLinuxOS. These mo-files, or any other mo-files found by our users in any other Linux distribution, are then added to the PCLinuxOS only mo-file database. The trick with using foreign mo-files is only useful for applications for which PCLinuxOS does not have any translation available.

PCLinuxOS mo-files have the highest priority, and any foreign mo-file will no longer be used as soon as a PCLinuxOS mo-file becomes available. Based on the concept "we do not need to translate what others have done already," the PCLinuxOS mo-file database is enriched by the Ubuntu mo-files and updated on a monthly basis. The locale-specific mo-file archives are packaged and uploaded to a server, from where they can be accessed for easy access to our users by AL. In this way, I can provide new, regularly updated translation information from my separate script without having to change anything in AL itself.

The new FAST-mode worked very well and completely replaced the previous REINSTALL-mode in the next version of AL, which had the exciting new feature to be also applicable on a LiveCD. This way, the user can start the English-only LiveCD, add the native locale to the system during the live session, and then install the already localized system to the hard disk. The next AL version 2.2 supported installing or upgrading to the latest localized version of OpenOffice 3.1.

GetOpenOffice

At this point, I heard about the quarterly update project and got in contact with Neal Brooks. I loved the idea of the project, and I am very grateful to Neal for providing great feedback when testing AL.

Due to space constraints, OpenOffice had to be removed from the 2009.2 CD. However, AL now had the option to include a localized version of OpenOffice. Based on Neal's suggestion, I re-used some sections of AL to fork a new application called GetOpenOffice (GOO). The first version GOO 0.3 provided a simple way to upgrade to or install the most recent localized OpenOffice corresponding to the current system locale. GOO addresses all potential pitfalls when upgrading OpenOffice, and frees the PCLinuxOS users from having to configure the special PCLinuxOS OpenOffice repository.

Based on a coincidental observation by Neal ("this is weird...") we found out that the available disk space for changes during a live session equals 49% of the available RAM. Armed with this new knowledge, I started recoding AL and GOO to test for sufficient disk-space before installing the user-selected options, which is of particular interest when running in a live session.

The next GOO version had the option to select any of the 104 OpenOffice locales from a list, independent of the current system locale. Further information on the availability and installation of localized OpenOffice dictionaries and a test for providing optional Java support in OpenOffice were added. The next versions of AL and GOO performed a rigorous test on the repository configuration in Synaptic which was found to be the source of issues reported by some users. In addition, a test for, and optional installation of, common fonts was added in order to improve the cross-platform compatibility of OpenOffice documents. OpenOffice is now also set to use its own dialogs for opening and saving files. This setting makes OpenOffice more robust to properly function on different window managers and was imperative to use GOO with KDE4. GOO 0.7 now supports any OpenOffice related task from installing, reinstalling, and adding further OpenOffice locales to completely uninstalling OpenOffice.

So, are these versions final? Well, I often thought so, but then something new popped up. Plus, the next major version of the best desktop environment is around the corner. Thank God, Tex is a KDE fan.

Hopefully AL and GOO will be useful to:

  • honor the great work of all the translators and stimulate others to join in, now that they can apply their translations easily.
  • spread PCLinuxOS around the Globe and provide many more people access to this fantastic OS in their native language.
  • make many new non-English speaking users join the PCLinuxOS forums so we can benefit from their new ideas to make PCLinuxOS even better.
  • add only a tiny script fitting on any LiveCD to provide always up-to-date access to gigabytes of language data, avoiding the need to pack them on a CD/DVD where they could be outdated after some time.
  • easily and quickly generate localized remasters of PCLinuxOS.
  • easily setup or customize OpenOffice.

Conclusion:

Localization only applies already existing language information and AL is just a user-friendly interface for the required steps, that's all. Considering that localization and support for internationalization virtually did not exist before in PCLinuxOS (except for some special community remasters), it is quite amazing to see how much can be achieved by simply applying existing information.

I am very grateful for all the positive feedback in the forums which helped make AL and GOO better meet the needs of the PCLinuxOS users. To hear that AL works well, and that it will help promoting PCLinuxOS to the non-English speaking community, is the biggest thank you I could ever receive!

Finally, I want to give special thanks to Neal and Tex, their patience, testing and support was essential to provide the PCLinuxOS users AL and GOO in its present form, radically simple applications.

Have fun!


PC-LXDE

Top | Next