2015-07-14 15:28:25 -04:00
|
|
|
The Monero command line tools can be translated in various languages.
|
|
|
|
In order to use the same translation workflow as the future GUI, they
|
|
|
|
use Qt Linguist translation files. However, to avoid the dependencies
|
|
|
|
on Qt this normally implies, they use a custom loader to read those
|
|
|
|
files at runtime. In order to update, or build translations files, you
|
|
|
|
do need to have Qt tools installed, however. For translating, you need
|
|
|
|
either the Qt Linguist GUI, or another tool that supports Qt ts files,
|
|
|
|
such as Transifex. To run, you do not need anything Qt.
|
|
|
|
|
|
|
|
To update ts files after changing source code:
|
|
|
|
|
|
|
|
./utils/translations/update-translations.sh
|
|
|
|
|
|
|
|
To add a new language, eg Spanish (ISO code es):
|
|
|
|
|
2016-08-24 11:01:32 -04:00
|
|
|
cp translations/monero.ts translations/monero_es.ts
|
2015-07-14 15:28:25 -04:00
|
|
|
|
|
|
|
To edit translations for Spanish:
|
|
|
|
|
|
|
|
linguist translations/monero_es.ts
|
|
|
|
|
|
|
|
To build translations after modiying them:
|
|
|
|
|
|
|
|
./utils/translations/build-translations.sh
|
|
|
|
|
|
|
|
To test a translation:
|
|
|
|
|
2016-09-03 16:03:44 -04:00
|
|
|
LANG=es ./build/release/bin/monero-wallet-cli
|
2015-07-14 15:28:25 -04:00
|
|
|
|
|
|
|
To add new translatable sources in the source:
|
|
|
|
|
|
|
|
Use the tr(string) function if possible. If the code is in a class,
|
|
|
|
and this class doesn't already have a tr() static function, add one,
|
|
|
|
which uses a context named after what lupdate uses for the context,
|
|
|
|
usually the fully qualified class name (eg, cryptonote::simple_wallet).
|
|
|
|
If you need to use tr in code that's not in a class, you can use the
|
|
|
|
fully qualified version (eg, simple_wallet::tr) of the one matching
|
|
|
|
the context you want.
|
|
|
|
Use QT_TRANSLATE_NOOP(string) if you want to specify a context manually.
|
|
|
|
|
|
|
|
If you're getting messages of the form:
|
|
|
|
|
|
|
|
Class 'cryptonote::simple_wallet' lacks Q_OBJECT macro
|
|
|
|
|
|
|
|
all is fine, we don't actually need that here.
|