| 1 | = Translation = |
| 2 | |
| 3 | == Marking Text for Translation == |
| 4 | |
| 5 | To mark text for translation wrap the string with the function `_()` like this: |
| 6 | {{{ |
| 7 | torrent.set_tracker_status(_("Announce OK")) |
| 8 | }}} |
| 9 | |
| 10 | For GTK you can move the translation out of the code and into the `glade` files: |
| 11 | {{{ |
| 12 | <property name="label" translatable="yes">Max Upload Speed:</property> |
| 13 | }}} |
| 14 | |
| 15 | For more detail see: [http://docs.python.org/library/gettext.html Python Gettext] |
| 16 | |
| 17 | == Translation Process == |
| 18 | |
| 19 | These are the overall stages in gettext translation: ''POT (Portable Object Template) files'' `->` '' PO (Portable Object) files'' `->` ''MO (Machine Object) files'' |
| 20 | |
| 21 | * `potfiles.in` created with `create_potfiles_in.py` |
| 22 | * `deluge.pot` created with `gettextize.sh` |
| 23 | * Upload `deluge.pot` located in `deluge/i18n/` to [https://translations.launchpad.net/deluge/trunk/ translation site] |
| 24 | * Wait for the translators to translate the text. |
| 25 | * Retrieve the updated `PO` files for each langauge from the translation site and extract to `deluge/i18n/` |
| 26 | * The binary `MO` files for each language are generated in `setup.py` by using the `msgfmt.py` script. |
| 27 | |
| 28 | |
| 29 | == Testing Translation == |
| 30 | |
| 31 | Verification that translations are working correctly can be performed by running deluge like this: |
| 32 | |
| 33 | If you do not have a particular language installed on your system it will only tranlate based on the binary MO files for Deluge so some GTK text strings will remain in English. |
| 34 | |
| 35 | {{{ |
| 36 | LANGUAGE=fr deluge |
| 37 | LANGUAGE=ru_RU.UTF-8 deluge |
| 38 | }}} |