1 | | = Translation = |
2 | | |
3 | | == Translators == |
4 | | |
5 | | To help translate Deluge please register at the Launchpad [https://translations.launchpad.net/deluge/ translation site] |
6 | | |
7 | | == Marking Text for Translation == |
8 | | |
9 | | To mark text for translation in Python and ExtJS wrap the string with the function `_()` like this: |
10 | | {{{ |
11 | | torrent.set_tracker_status(_("Announce OK")) |
12 | | }}} |
13 | | |
14 | | For GTK you can move the translation out of the code and into the `glade` files: |
15 | | {{{ |
16 | | <property name="label" translatable="yes">Max Upload Speed:</property> |
17 | | }}} |
18 | | |
19 | | For more details see: [http://docs.python.org/library/gettext.html Python Gettext] |
20 | | |
21 | | == Translation Process == |
22 | | |
23 | | These are the overall stages in gettext translation: ''POT (Portable Object Template) files'' `->` '' PO (Portable Object) files'' `->` ''MO (Machine Object) files'' |
24 | | |
25 | | * `potfiles.in` is created using `create_potfiles_in.py`. |
26 | | * `deluge.pot` is created using `gettextize.sh`. |
27 | | * Upload `deluge/i18n/deluge.pot` to [https://translations.launchpad.net/deluge/ Translation site] |
28 | | * Wait for the translators to translate the text. |
29 | | * Download the updated `PO` files from translation site, extract to `deluge/i18n/` and strip the `deluge-` prefix: {{{rename -f 's/^deluge-//' deluge-*.po}}} |
30 | | * The binary `MO` files for each language are generated in `setup.py` by using the `msgfmt.py` script. |
31 | | |
32 | | To enable WebUI to use translations update `gettext.js` by running `gen_gettext.py` script. |
33 | | |
34 | | == Useful Applications == |
35 | | |
36 | | * [http://puszcza.gnu.org.ua/projects/podiff/ podiff] - Compare textual information in two PO files |
37 | | * [http://projects.gnome.org/gtranslator/ gtranslator] - GUI po file editor |
38 | | * [http://www.poedit.net/ Poedit] - GUI po file editor |
39 | | |
40 | | == Testing Translation == |
41 | | |
42 | | Verification that translations are working correctly can be performed by running deluge as follows. |
43 | | |
44 | | Create an `MO` for a single language in the correct sub-directory: |
45 | | |
46 | | {{{ |
47 | | mkdir -p deluge/i18n/fr/LC_MESSAGES |
48 | | python msgfmt.py -o deluge/i18n/fr/LC_MESSAGES/deluge.mo deluge/i18n/fr.po |
49 | | }}} |
50 | | |
51 | | Run Deluge using an alternative language: |
52 | | {{{ |
53 | | LANGUAGE=fr deluge |
54 | | LANGUAGE=ru_RU.UTF-8 deluge |
55 | | }}} |
56 | | |
57 | | Note: If you do not have a particular language installed on your system it will only translate based on the `MO` files for Deluge so some GTK text/button strings will remain in English. |
| 1 | Moved to: https://deluge.readthedocs.io/en/develop/contributing/translations.html |