[Last updated at Build 0.5.5]
Version 1.0
Copyright (C) 1999 AbiSource, Inc., All Rights Reserved.
jeff@abisource.com
AbiSource, Inc.
This document describes the steps necessary to localize AbiWord to a new language. At the present time (build 0.5.5) localization is limited to the strings for menu and toolbars that are compiled into the executable and the strings for various dialogs and error message boxes that can be dynamically loaded at runtime. We have not yet addressed localization issues for the application installers, on-line help, manuals, and etc.
No, we don't use
Our localization procedure consists of three basic steps:
[1] create a LabelSet for the menu;
[2] create a LabelSet for the toolbar; and
[3] create a set of strings for the dialogs and error messages.
AbiWord contains a dynamic, cross-platform menu system that allows various builtin (and eventually dynamically loaded) menu layouts to be selected and synthesized as needed. Code for the menu system is broken into the following parts:
[a] the Potential Set of menu actions (the complete set of actions to which a menu item may be bound);
[b] the set of menu-helper functions (used to compute gray-state and etc. on menu activation);
[c] a series of Menu_Layouts (one or more nested lists giving the Menu_Items and their ordering);
[d] a series of Menu_LabelSets (one for each language we want to support).
For most Latin-1 languages, you should be able to just use the Menu_Layouts as is. If, for example, your language has no concept of Italic, you might want to make a new layout which did not include Italic. It is my belief that this feature will not be used until we get to CJKV. I'll describe this in a future update.
The part we are most interested in is [d]. The file
AbiWord contains a dynamic, cross-platform toolbar system .... blah, blah, blah .... just like the menu system. The only difference is that the Toolbar_LabelSet also includes a reference to the icon to be used on the toolbar button. I put this here so that we could change the icon by language. For example, we use an icon with a fat
The file
If you'd like to change the icons -- especially for BOLD, ITALIC, UNDERLINE, and STRIKEOUT, look in the directory abi/src/wp/ap/xp/ToolbarIcons and see if there's an XPM that suits your needs or create one. If you do decide to create a new XPM, add a reference to it in
Menu and Toolbar strings are compiled into the source -- so that the program always remains mostly usable in each language no matter how trashed the system installation. Dialogs and Error Messages are builtin for English and are dynamically loaded from an x
With a DEBUG build of version 0.5.5 (or later), launch AbiWord with the command:
./AbiWord -dumpstrings
This will create the file en-
As of 0.5.5, there are a few problems with this:
[1] Sometimes, expat (the XML parser that we use) doesn't like some high-byte Latin-1 characters. I've had it choke on
[2] We currently following Win32 convention of using
In src/af/util/xp/ut_Language you’ll see a list of locale/language mappings. This is used to mark words as being in a particular language and is used by the spell-checker and could be used in a thesaurus, etc...
You’ll want to add a locale/hashfile mapping for ispell dictionaries in src/other/spell/xp/ispell_checker.cpp - it’s 1 line of code
Testing your translation is a little awkward at this point because we haven't gotten the installer finished or the options/preferences dialog to let you interactively change your language. So, for now, we do it the hard way...
[1] look at your preferences file:
on Unix this is
on Win32 this is varies considerably between Windows versions and how the system was installed, so check the debug output for the message "Constructed preference file name ...".
[2] change both occurrences of
[3] change all three instances of
[4] either change the value of {
[5] launch AbiWord again. In the debug output, you should find something like the following:
If you are missing any strings in the .strings file, you'll see warning like the following:
[6] At this point, you have a **mostly** localized user-interface -- there are still some rough edges and places we still need help with, but all-in-all, this is a pretty good start.
[7] email a patch file to me or to the abiword-dev mailing list and we'll get it into the next version of the source.
At present, AbiWord is still growing and evolving and occasionally there is a need to add new strings to the application. The code is set to use the selected language strings, if available, and to fall back to the builtin English strings when items are missing from the translation. The code is also set to issue warnings or asserts at startup should there be an incomplete translation.
We'll need your help to occasionally review the translation files and update them as things change in the English version. Thanks.