deluge/docs/source/contributing/translations.md
Calum Lind 82ecf8a416 [Docs] Reorganise and add sections from wiki
- Change the layout and contents of docs to be better organised and
  follow ideas from: https://www.divio.com/blog/documentation/
- Use markdown for non-technical documents to speed up writing.
- Added new sections and imported documents from Trac wiki.

Build fixes:

- Added a patch to fix recommonmark 0.4 and doc referencing:
    https://github.com/rtfd/recommonmark/issues/93
- Set docs build in tox to Py2.7 since there are problems with autodoc
  mocking multiple inheritance on Python 3 resulting in metaclass errors.
- Supressed warning about `modules.rst` not in the toctree by creating
  a static `modules.rst` with `:orphan:` file directive and add to git.
  Also skip creating this toc file with sphinx-apidoc in setup and tox.
- Simplified finding exported RPC and JSON API methods by adding an
  autodoc custom class directive. Removed unneeded __rpcapi.py.
2018-11-01 17:38:10 +00:00

66 lines
2.1 KiB
Markdown

# Translation contributions
## Translators
For translators we have a [Launchpad translations] account where you can
translate the `.po` files.
## Marking text for translation
To mark text for translation in Python and ExtJS wrap the string with the
function `_()` like this:
torrent.set_tracker_status(_("Announce OK"))
For GTK the text can also be marked translatable in the `glade/*.ui` files:
<property name="label" translatable="yes">Max Upload Speed:</property>
For more details see: [http://docs.python.org/library/gettext.html Python Gettext]
## Translation process
These are the overall stages in gettext translation:
`Portable Object Template -> Portable Object -> Machine Object`
- The `deluge.pot` is created using `generate_pot.py`.
- Upload `deluge/i18n/deluge.pot` to [Launchpad translations].
- Give the translators time to translate the text.
- Download the updated `.po` files from translation site.
- Extract to `deluge/i18n/` and strip the `deluge-` prefix:
rename -f 's/^deluge-//' deluge-*.po
- The binary `MO` files for each language are generated by `setup.py`
using the `msgfmt.py` script.
To enable WebUI to use translations update `gettext.js` by running `gen_gettext.py` script.
## Useful applications
- [podiff](http://puszcza.gnu.org.ua/projects/podiff/) - Compare textual information in two PO files
- [gtranslator](http://projects.gnome.org/gtranslator/) - GUI po file editor
- [Poedit](http://www.poedit.net/) - GUI po file editor
## Testing translation
Testing that translations are working correctly can be performed by running
Deluge as follows.
Create an `MO` for a single language in the correct sub-directory:
mkdir -p deluge/i18n/fr/LC_MESSAGES
python msgfmt.py -o deluge/i18n/fr/LC_MESSAGES/deluge.mo deluge/i18n/fr.po
Run Deluge using an alternative language:
LANGUAGE=fr deluge
LANGUAGE=ru_RU.UTF-8 deluge
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.
[launchpad translations]: https://translations.launchpad.net/deluge/