Merge pull request #2123

eb71ebbe Formatting README.i18n.md as Markdown. (Jonathan Cross)
This commit is contained in:
Riccardo Spagni 2017-07-03 12:29:45 +02:00
commit cde5103b7a
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -1,11 +1,17 @@
Monero daemon internationalization
==================================
The Monero command line tools can be translated in various languages. 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 In order to use the same translation workflow as the [Monero Core GUI](https://github.com/monero-project/monero-core), 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.
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 ### Tools for translators
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, In order to create, update or build translations files, you need to have Qt tools installed. For translating, you need either the **Qt Linguist GUI** ([part of QT Creator](https://www.qt.io/download-open-source/#allDownloadsDiv-9) or a [3rd-party standalone version](https://github.com/lelegard/qtlinguist-installers/releases)), or another tool that supports Qt ts files, such as Transifex. The files are XML, so they can be edited in any plain text editor if needed.
such as Transifex. To run, you do not need anything Qt.
### Creating / modifying translations
You do not need anything from Qt in order to use the final translations.
To update ts files after changing source code: To update ts files after changing source code:
@ -27,16 +33,9 @@ To test a translation:
LANG=es ./build/release/bin/monero-wallet-cli LANG=es ./build/release/bin/monero-wallet-cli
To add new translatable sources in the source: To add new translatable strings in the source code:
Use the tr(string) function if possible. If the code is in a class, 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.
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: If you're getting messages of the form: