From: Raphael Finkel (raphael@cs.uky.edu)
Date: Tue Feb 11 2003 - 09:26:54 EST
Thanks to Dom and others for helping me clarify how AbiWord and gtk+ work
together to handle localization/internationalization (l10n, i18n for short).
Assuming a permanent fix to bug 4209, the following document contains the
information that I have collected. I recommend it be placed in the
source distribution as po/TRANSLATE.HOWTO . Parts of it might be helpful for
users, not just developers.
Raphael Finkel
------------
NOTES FOR TRANSLATORS
Raphael Finkel
raphael@cs.uky.edu
A. Getting started
A.1. If you want to work on a particular language, say Pelonian (language
zz-ZZ), you may start this way:
./update.pl --pot
mv abiword.pot zz-ZZ.po
(The .po suffix doesn't mean Pelonian; it applies to any language.) Now edit
zz-ZZ.po. Fix the comment at the start to indicate who you are, what the
language is, and when you are doing this work.
A.2 I strongly recommend you use Unicode UTF-8 to encode all your Pelonian
strings. In the comment at the top of zz-ZZ.po, make sure the following two
lines appear:
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: UTF-8\n"
A.3. Now you want to translate all lines that start with msgid
and place the translation in place of the empty string in the following msgstr
line. For instance, you might translate
msgid "the dictionary"
msgstr "grompabikku-la"
(Sorry, my knowledge of the Pelonian language is limited.)
Translate as many entries as you like. Entries that have %d or %s should most
likely be translated with %d and %s in place, referring to numeric or string
data to be filled in later. Don't worry that lines get very long. If you like,
you may divide long lines:
msgstr ""
"implog revulam"
"groppsigu moturo nula"
Later processing steps will automatically divide long lines for you in any case.
A.4. Once you have translated as much as you want, run this script:
./ui-backport.pl zz-ZZ
This program places strings in ../user/wp/strings/zz-ZZ.strings. The next time
you build AbiWord, the Pelonian strings will be available, or you can manually
copy the strings file to $prefix/AbiSuite-2.0/AbiWord/strings/zz-ZZ.strings
and see them immediately when you next run AbiWord.
A.5. Later, you will want to fix your translations, finish strings you didn't
translate earlier, and see if new strings have been introduced into AbiWord
that you need to translate. Run this script:
./update.pl zz-ZZ
You will be see a summary that tells you how many messages have been translated
and how many are still untranslated. It will also indicate how many "fuzzy"
translations there are. These are translations that you have made but which
may no longer be right, because AbiWord no longer uses quite the same text in
the message that it did when you first made the translation. Search for the
word "fuzzy" in zz-ZZ.po, and fix all such translations, if necessary. Remove
the line that says "fuzzy" to indicate that you have fixed them. Then do
whatever other translations you want, and backport as indicated above.
A.6.There are several alternative techniques for building Pelonian string
files, although I don't recommend them.
A.6.i. Look in http://www.abisource.com/dev/strings/strings.html (quite long;
all you need is the beginning) to find a fairly complete translation of some
language that you can work from, perhaps because the language is related to
Pelonian. Say you choose no-NO. Copy user/wp/strings/no-NO.strings to
user/wp/strings/zz-ZZ.strings and modify the translations. Disadvantages: (a)
You can't easily keep up with new strings added to AbiWord over time, (b) You
can't easily find which Pelonian strings you haven't done yet, (c) In the cases
where the same English string occurs in multiple instances, you need to
introduce your Pelonian translation for each instance. (d) You have to trust
the no-NO translation, which is one step removed from the English source.
A.6.ii. Run AbiWord --dumpstrings; you will find a fresh file in the current
directory called en-US.strings. Copy this file to
user/wp/strings/zz-ZZ.strings and edit it. Disadvantages: (a-c) above.
B. Unix and Gtk+ issues
B.1. In order for your translations to appear, you need to set your environment
to specify your language. Before you start AbiWord, set your LANG and
LC_MESSAGES environment variables to
LANG=zz-ZZ.utf8
LC_MESSAGES=zz_ZZ
AbiWord uses the LANG variable; Gtk+ uses the LC_MESSAGES variable.
When you run AbiWord, you should see all the strings you have translated in
Pelonian, not in English.
B.2. You might not like the font in which Pelonian is displayed. In your home
directory, place a file called
.gtkrc-2.0
In that file, place a line saying
gtk-font-name = "sans 20"
The 20 is a size indicator; you may change that if you like.
Now you must tell Pango (which actually draws the fonts) what you mean by sans
20. Edit /usr/local/etc/pango/pangox.aliases (it may be in a different
place). Add your favorite Pelonian font (mine is
-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1) to the top of the
entry for "sans normal normal normal normal".
B.3. Your AbiWord translations only apply to those menus and buttons that
AbiWord builds for itself. AbiWord also uses "stock" items from Gtk+,
including buttons that say "Cancel" and "OK". If you don't see these messages
in Pelonian, you need to introduce Pelonian strings to the gtk+ library. Get
the source distribution of gtk+ (mine is gtk+-2.0.0 as of 2/2003). In the po
subdirectory, run
./update.pl --pot
mv abiword.pot zz_ZZ.po
and edit the zz_ZZ.po file just as you did for Abiword, paying especial
attention to those items labeled with gtk/gtkstock.c.
Modify the Makefile, adding zz_ZZ.po and zz_ZZ.gmo everywhere you
see zh_CN.po.
make zz_ZZ.gmo
make install (you may need privilege)
B.4. If you get the error message that your zz_ZZ locale isn't recognized, or
you don't see stock items in Pelonian, try
locale -a
If zz_ZZ is not listed, you need to set up Pelonian as one of the supported
locales on your machine. You will need privilege, typically as root.
cd /usr/share/i18n/locales/
[pick any language that seems similar to Pelonian, such as en_GB]
cp en_GB zz_ZZ
[edit zz_ZZ as needed, or just leave it the way it is]
localedef -i zz_ZZ -c zz_ZZ
[there will be error messages, but the -c will force it to work]
This archive was generated by hypermail 2.1.4 : Tue Feb 11 2003 - 09:30:53 EST