New AbiWord Translation
New AbiWord Translation
These instructions will allow you to translate AbiWord for a language that does not have an existing translation yet.
Step 1: Download AbiWord via SVN<p>There are Instructions for using SVN to download AbiWord's source code.
$ svn co http://svn.abisource.com/abiword/trunk abiword
Step 2: Build a New Translation File
You need a build a file called abiword.pot which is basically a blank translation of AbiWord's strings.
To do this, go into the abiword/po directory and run the "update.pl" script as follows:
$ ./update.pl --pot
This should produce the file abiword.pot.
Now you are ready to make the new translation file for your language. All you need to do is rename abiword.pot to the form xx-YY.po where xx or xxx is your ISO language code and YY is your ISO country code. For example, fr-FR is French, pt-BR is Brazilian Portuguese, and arn-CL is Mapudungun from Chile. (If you don't know the ISO code for your language, look here and here and see this list of ISO county codes.)
$ mv abiword.pot xx-YY.po
Step 3: Translate xx-YY.po
Each phrase to translate in the file xx-YY.po will appear in this format:
The important elements are the msgid which contains the orignal phrase in English and the msgstr which contains the translated phrase. You only need to change the msgstr. For example, if you are translating the msgid "Cancel" into Spanish, you would only need to change from this:
If you are unsure how to translate a string, it is good idea to mark it with a "fuzzy" flag and leave a comment for the next translator to check it. For instance if you don't know whether to translate "Cancel" as "Cancelar" or "Anular", you could change this entry to:
# Should it be "Cancelar" or "Anular"?
Strings which contain a "&" or "&" can be accessed with a key press in a menu or a dialog box. The character following the & or "&" will be underlined to tell the user which key to press.
For example, the menu item "&Header" would appear as "Header" and can be reached by pressing H or Alt + H. The Spanish translation of "Header" is "Cabecera", so the strings would look like this:
Only underline one character per menu item and avoid chosing thin characters such as 'i' or 'l' because it will be difficult for the AbiWord user to see that these characters are underlined. Also avoid underlining characters such as 'j' and 'y' whose strokes are lower than normal letters and difficult to read when underlined.
Long strings that are difficult to read can be broken into multiple lines by enclosed extra lines in double quotation marks. Breaking the string into multiple lines will have no effect on the final string, since the computer will strip away any spaces and hard returns outside of the quotation marks.
If you want to put double quotation marks inside a string, use the escape code \" The escape code \n adds a hard return to a string and \t adds a tab. As a general rule, only add these escape codes to the msgstr if they are found in the msgid. If you see %s or %d in the msgid, that indicates that a string variable or a numerical variable will be inserted into the string at that point. Make sure that the msgstr contains the same number of these variables as are found in the msgid.
For instance, here is a good example of a screen message with a number of escape codes and variable codes. Notice how it is broken up over several lines to make it easier to read and each line is enclosed in double quotation marks:
"%s not implemented yet.\n\n"
"If you are a programmer, feel free to add code in %s, line %d\n"
"and mail patches to:\n\n"
"Otherwise, please be patient."
"%s todavía no está implementado.\n\n"
"Si usted es un programador, siéntase libre para añadir código en %s, línea %d\n"
"y enviar parches a:\n\n"
"En otro caso, tenga paciencia."
You can edit the file xx-YY.po with any text editor so long as you save it in the same character encoding which is listed in the header of the PO file. It is best to use UTF-8 (8-bit Unicode) encoding. To avoid syntax errors, use a text editor that recognizes source code such as emacs, vim, gedit, or kate so that you can see when you improperly terminated a string or forgot to enclose it in double quotation marks. Notepad++ is a good text editor for Windows users. (Set "Language" to "C" and mark "Encode in UTF-8" under "Format").
Some people prefer to use special translation software such as KBabel or poedit which has translation memory so you only have to translate a phrase once. These programs also help you maintain a consistant translation for every instance of a word. If multiple people will be working on the translation, it may be easier to use a web-based PO translator such as Pootle.
If you are translating in a language which borrows a lot of frases from another language, you can use the script instrans.php to insert translations from that other language. For example many indigenous language in Latin America use Spanish frases for computer terminology. A translator can leave these terms blank and use instrans.php to insert the Spanish frases in the PO file. In addition, people who can't read English or want to see the translation in a third language can use instrans with the --comment option to insert the translations from another language in the comment field in the PO file. For instance, translators of Quechua (an indigenous language of the Andes) often want to see the translation in Spanish before translating into Quechua.
Step 4: Check the Translation
After you have finished your translation, you should check how it will appear in AbiWord. In order to test your translation you will have to convert it from a .po file to a .string file with the perl script ui-backport.pl. Go to the abiword/po directory and issue the command:
$ ./ui-backport.pl xx-YY
This script will create a file called xx.YY.string in the directory abiword/user/wp/strings. If you have downloaded the complete source code you can compile and install AbiWord now and see if your translation worked. Instead, you may also test your translation with an existing installation of AbiWord. Find the AbiWord/strings directory in your installed copy of AbiWord. On Linux/UNIX you will typically find it at /usr/share/AbiSuite-2.X/AbiWord/strings and in Windows at c:\Program Files\AbiSuite2\Abiword\strings. In Linux/UNIX/OS X you can find your string file with the locate command:
$ locate xx-YY.string
Now replace the existing .string file with the one that you just created. Rename the existing xx-YY.string file to xx.YY.string.old and then copy your new .string file from the directory abi/user/wp/strings to AbiWord/strings. If you have abiword trunk checked out in the home/user directory, the commands would be:
enter the root password
# cd /usr/share/AbiSuite-2.X/AbiWord/strings
# mv xx-YY.strings xx-YY.strings.old
# cp /home/user/abi/user/wp/strings/xx-YY.strings ./
If you are using Windows, start up AbiWord and go to Tools->Preferences and change the "User Interface Language" to your language. After you quit and restart AbiWord, the program should using your new translation. If you are starting a new translation of AbiWord, then AbiWord probably doesn't recognize your language because it doesn't have a language code for it yet. You can still test your translation by renaming your .strings file to an existing .strings file with a different language code. For instance, you could rename it as pt-BR.strings and then select Brazilian Portuguese as your user interface language to see your translation in AbiWord
To order to run AbiWord with your translation in Linux/UNIX/OS X, your locale needs to be set to your translation language. Check what language you are currently in:
If your locale doesn't match the language of your .string file, change it to match:
$ export LANG
Now run AbiWord. If AbiWord starts up in English, then there is probably something wrong with your PO file. Check that all the strings terminate in double quotation marks and that the number of %s and %d codes in the msgid matches the number in msgstr.
Open all the dialog boxes in AbiWord and make sure that your translations fit in the available space. You may have to use shorter phrases to fit in the buttons. Check each menu and submenu to see whether each menu item can be accessed with a key press and no shortcut character has been assigned to more than one item in a menu. Also check to see that the underlined character is easy to see for each menu item. Check the shortcut characters in dialog boxes as well.
If possible you should check your translation in both Windows and Linus/UNIX because many of the dialog boxes such as "Preferences" are not the same in different operating systems.
Don't worry if you see some of the standard buttons in dialog boxes in a different language other than your translation. In some of its dialog boxes AbiWord is using standard system buttons whose appearance isn't controlled by xx-YY.strings file. In Windows, these buttons will appear in the language of the operating system. Since Windows Unicode Port is in progress, you may find some of the dialogs in incomplete state in Windows. In Linux/UNIX your standard system buttons will default to English if your system doesn't recognize your language or have a translation for your language. This can be a very annoying feature if you are working with a minority language like Quechua or Basque where you would prefer the buttons to default to a different language like Spanish, but there is nothing that you can do about it.
When you have finished using AbiWord, remember to return your system to its original language using LANG and export.
Step 5: Submit the Translation
After you have translated and tested your translation, please send your xx-YY.po file to the developer's mailing list so that we can incorporate your translation into the project. Please zip the attachment before sending it, as that will be more convenient for users on slow internet connections, and to prevent it from being marked as spam my our mail server.
You can subscribe to the mailing list by sending an email to email@example.com with the word "subscribe" in the mesage body. Once you're subscribed, you can send an email to firstname.lastname@example.org and attach your translation. Please zip or gzip your attachment before sending it, otherwise it might be too large or marked as spam.
If you started translating your xx-YY.po file several months ago, you may want to update it before submitting it to be included in the project source code. In a couple months time, some of the original msgid strings may have changed and new ones may have been added.
To update your xx-YY.po file, take an svn update on the abiword trunk and copy your xx.YY.po file into the abiword/po directory. Then run the update.pl script to check for changes:
$ ./update.pl xx-YY
The update.pl script will not only add any new strings to be translated, it will also mark any changed strings with a "fuzzy" flag. You can do a search for the word "fuzzy" to find these changed strings, so you can change them before submitting your translation.