diff options
author | kali <kali@leap.se> | 2012-12-21 07:44:59 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-12-21 07:45:14 +0900 |
commit | 654b83db5f050a94f9637fb1ce80df5cb7ed5a38 (patch) | |
tree | 4621653d602c1951e4584c8c66f6607e5eceae4b /docs/dev/internationalization.rst | |
parent | b0c3c9194447f20306111a31ee5a6d4828fed158 (diff) |
updated "translate" to work in objects other than QObjects
Diffstat (limited to 'docs/dev/internationalization.rst')
-rw-r--r-- | docs/dev/internationalization.rst | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/docs/dev/internationalization.rst b/docs/dev/internationalization.rst index e6b89dea..1a9af0be 100644 --- a/docs/dev/internationalization.rst +++ b/docs/dev/internationalization.rst @@ -38,21 +38,30 @@ tl;dr;:: self.tr('your string') -for any string that you want to be translated. +for any string that you want to be translated, as long as the instance derives from ``QObject``. + +If you have to translate something that it is not a ``QObject``, use the magic leap ``translate`` method: + + +.. code-block:: python + + from leap.util.translations import translate + + class Foo(object): + bar = translate(<Context>, <string>, <comment>) + .. Note about this: there seems to be some problems with the .tr method - on QObjects. Investigate this. - I still believe we can use a generic _ method which is smart enough to - fallback to QObject.tr methods or lookup our own tr implementation (for our - multilungual objects, like in exceptions or provider labels that came from json objects). + so the translate method could actually be the preferred thing in all the cases. + Still missing what to do for language labels (json-based). --kali For i18n maintainers ^^^^^^^^^^^^^^^^^^^^ -You need ``pylupdate4`` for these steps. To get it, in debian:: +You need ``pylupdate4`` and ``lrelease`` for these steps. To get it, in debian:: - $ apt-get install python-qt4-utils + $ apt-get install pyqt4-dev-tools qt4-linguist-tools If you do not already have it, install the ``transifex-client`` from the cheese shop:: |