- 1 Introduction
- 2 Translate
- 3 Common problems
Thanks for your interest in translating aMule. Becoming a translator isn't hard, you just need to understand common English and of course your native tongue.
The status of all translations are updated hourly at the Translation statistics page, that's an easy way to see if your work is needed. But you're always welcome to check an existing translation for errors or improve unfavourable expressions.
Before you start any work, please check the translations list for an entry for your language. If there's already someone working on the translation for your language, please reply to the forum topic for your language before you start working. It would be a shame to have two translators doing the same work, wouldn't it?
Get Translation file
You can get current Portable Object (po) files for all supported languages at the Translation statistics page. Just click on the name of your language and download the po-file.
Start a new translation
Your language isn't yet supported by aMule and you can't find a po-file at the statistics page? No problem, let's start a new translation! Either open a new topic in the translations forum to receive help with the translation process or create the po-file yourself:
To do so, please download the amule.pot file, which is linked at the bottom of the Translation statistics page. Then you need gettext installed on your system (comes by default with most operating systems) and the language code of your language. If you don't know the language code of your language, you should be able to find the code in the list of language codes on Wikipedia. If you've done so, use the following command to create the po-file:
msginit --input=amule.pot --locale=language code
If you decide to create your own po-file, please have a loot at the Plural forms section of this page.
The translation process
Now that you've got the po-file, let's start with the actual translation process. There are several programs to help you with this task, like Poedit, gtranslator or KBabel, but you can use your favourite text editor, too.
Here's a quick start for these editors, please refer to their respective home pages for a more extensive documentation.
When you open a po-file in Poedit, you are greeted by a screen similar to the following:
In the bottom, you'll find statistics. Not translated strings are marked in shades of turquoise in the string list in the upper part, fuzzy strings in brown-sand tones and translated strings in grey/white.
The actual translation takes part in the middle part of the window.
You'll see the English source string at the top and the field to enter the translations below. Here's even a special case with plural forms. When you're done entering the translated page for one string you can go on by clicking on the next string to translate.
When you're done translating, continue with testing your translation.
Another powerful editor is the KDE-based KBabel.
The user interface is customizable, but in the default view, you'll find the string list, the source string and the input field for translations on the left side. Statistical information are on the bottom, just as with Poedit.
By clicking on the Next Fuzzy or Untranslated-button in the toolbar, KBabel will jump directly to the next string in need of some work.
The actual translation interface is very similar to Poedit, in the upper part you'll see the source string and below you can enter the translation.
Using a text editor
po-files are just text files and of course you can use any text editor to edit them. Popular editors Emacs and Vim both provide corresponding plugins.
The file format is pretty simple, but please refer to the section in the gettext manual for further information.
Test the translation
Use the following command to test a translation:
msgfmt -c --statistic language code.po
$ msgfmt -c --statistics ca.po 1428 translated messages, 58 fuzzy translations, 32 untranslated messages.
Please refer to the Common problems section if any error messages appear. Don't hesitate to attach your po-file in the translations forum and ask for help, if you can't solve the problems yourself. I'll try to fix the problems and explain what went wrong.
Getting the translation into aMule
Find your language in the translations list and attach the po-file in a new reply to your language's topic (click on the language name to go to your language's topic).
If you can't find a topic for your language, just create a new one in the translations forum.
Strings are marked fuzzy after a change of the source string of an already translated string. This just means that the translator should review the string and see if the change has any influence on the translation.
An example: "Delete server?" was replaced by "Do you really want to remove the server?". The content is the same and only the wording was changed. Depending on the translation there may be no changes necessary.
message compilation errors
After testing the translation, you get an error message. Here's a list of common errors and the solution:
- end-of-line within string
- A string started by " (quotation marks) wasn't closed by another ". Take a look at the line number and close the string.
- format specifications in 'msgid' and 'msgstr' for argument 1 are not the same
- You've probably noticed things like '%s' or '%d' in the source strings. These are later replaced by a variable, for instance a string for %s and an number for %d. Please check all your %-constructs in the translated string (use the line number in the error message to find the string) and see if they are the same as in the source string.
- number of format specifications in 'msgid' and 'msgstr' does not match
- This is similar to above error. You don't have the same quantity of %-constructs in the source and translation. Check the translation, maybe you've forgotten one or you accidentally wrote '&s' when you meant '%s'
- `msgid' and `msgstr' entries do not both end with '\n'
- '\n' is a new line in a string. You need the same number of new lines in the translation as in the source. Try to place them similar to the source string.
Plurals are handled differently in various languages. Whilst English or German have a singular and a plural form, other languages like Turkish don't distinguish between plural or singular and there are languages which use different plurals for different numbers, e.g. Polish.
The first thing you need is the appropriate header in your po-file. You'll find help in the gettext manual on plural forms or the list of plural forms. If you have trouble to add the header, please ask in the translations forum.
An example for German:
"Plural-Forms: nplurals=2; plural=n != 1;\n"
Plural forms are represented in the source as follows (extract from de.po for German):
#: src/kademlia/routing/RoutingZone.cpp:141 #, c-format msgid "Read %u Kad contact" msgid_plural "Read %u Kad contacts" msgstr "Lese %u Kad-Kontakt" msgstr "Lese %u Kad-Kontakte"
The first msgid is the source for the singular, the msgid_plural is the plural source. Note the index msgstr gets for plural strings. Each index is for a different plural form. In the case of German msgstr is the singular string and msgstr is used for plural forms.
This is similar for other languages. If you are in doubt about which index corresponds to which plural form, please ask in the translations forum.
my program doesn't allow me to jump to a line
kpeace1 wrote a script which converts line numbers in error messages to msgids and makes easier.
#!/usr/bin/env python import sys if (len(sys.argv) < 3): print "usage:\t", sys.argv, "file_name ", "line#" file_name = sys.argv line_number = int(sys.argv) po_file = open(file_name) i = 0 msgid = 0 for line in po_file: i = i + 1 if (line[:5] == "msgid"): msgid = msgid + 1 if (line_number == i): print "error in msgid no.", msgid-1 sys.exit(0)