2011-11-08 16:19:52 +01:00
|
|
|
Translations
|
|
|
|
============
|
|
|
|
|
2012-03-20 15:19:14 +01:00
|
|
|
The Qt GUI can be easily translated into other languages. Here's how we
|
2011-11-08 16:19:52 +01:00
|
|
|
handle those translations.
|
|
|
|
|
|
|
|
Files and Folders
|
|
|
|
-----------------
|
|
|
|
|
2015-01-30 12:31:22 +01:00
|
|
|
### darkcoin-qt.pro
|
2011-11-08 16:19:52 +01:00
|
|
|
|
|
|
|
This file takes care of generating `.qm` files from `.ts` files. It is mostly
|
|
|
|
automated.
|
|
|
|
|
|
|
|
### src/qt/bitcoin.qrc
|
|
|
|
|
|
|
|
This file must be updated whenever a new translation is added. Please note that
|
|
|
|
files must end with `.qm`, not `.ts`.
|
|
|
|
|
|
|
|
<qresource prefix="/translations">
|
2015-01-30 12:31:22 +01:00
|
|
|
<file alias="en">locale/darkcoin_en.qm</file>
|
2011-11-08 16:19:52 +01:00
|
|
|
...
|
|
|
|
</qresource>
|
|
|
|
|
|
|
|
### src/qt/locale/
|
|
|
|
|
|
|
|
This directory contains all translations. Filenames must adhere to this format:
|
|
|
|
|
2015-01-30 12:31:22 +01:00
|
|
|
darkcoin_xx_YY.ts or darkcoin_xx.ts
|
2011-11-08 16:19:52 +01:00
|
|
|
|
2015-01-30 12:31:22 +01:00
|
|
|
#### darkcoin_en.ts (Source file)
|
2011-11-08 16:19:52 +01:00
|
|
|
|
2015-01-30 12:31:22 +01:00
|
|
|
`src/qt/locale/darkcoin_en.ts` is treated in a special way. It is used as the
|
2012-03-20 15:19:14 +01:00
|
|
|
source for all other translations. Whenever a string in the code is changed
|
2015-01-30 12:31:22 +01:00
|
|
|
this file must be updated to reflect those changes. A custom script is used
|
2012-10-04 08:13:37 +02:00
|
|
|
to extract strings from the non-Qt parts. This script makes use of `gettext`,
|
2015-01-30 12:31:22 +01:00
|
|
|
so make sure that utility is installed (ie, `apt-get install gettext` on
|
|
|
|
Ubuntu/Debian). Once this has been updated, lupdate-qt4 (included in the Qt SDK)
|
|
|
|
is used to update darkcoin_en.ts. Simply run:
|
|
|
|
|
|
|
|
lupdate-qt4 ./contrib/darkcoin-qt.pro -ts ./src/qt/locale/darkcoin_en.ts
|
|
|
|
|
2012-07-11 21:40:35 +02:00
|
|
|
##### Handling of plurals in the source file
|
|
|
|
|
|
|
|
When new plurals are added to the source file, it's important to do the following steps:
|
|
|
|
|
2015-01-30 12:31:22 +01:00
|
|
|
1. Open darkcoin_en.ts in Qt Linguist (also included in the Qt SDK)
|
2012-07-11 21:40:35 +02:00
|
|
|
2. Search for `%n`, which will take you to the parts in the translation that use plurals
|
|
|
|
3. Look for empty `English Translation (Singular)` and `English Translation (Plural)` fields
|
|
|
|
4. Add the appropriate strings for the singular and plural form of the base string
|
|
|
|
5. Mark the item as done (via the green arrow symbol in the toolbar)
|
|
|
|
6. Repeat from step 2. until all singular and plural forms are in the source file
|
|
|
|
7. Save the source file
|
|
|
|
|
|
|
|
##### Creating the pull-request
|
|
|
|
|
|
|
|
An updated source file should be merged to github and Transifex will pick it
|
|
|
|
up from there (can take some hours). Afterwards the new strings show up as "Remaining"
|
|
|
|
in Transifex and can be translated.
|
|
|
|
|
|
|
|
To create the pull-request you have to do:
|
|
|
|
|
2015-01-30 12:31:22 +01:00
|
|
|
git add src/qt/bitcoinstrings.cpp src/qt/locale/darkcoin_en.ts
|
2012-07-11 21:40:35 +02:00
|
|
|
git commit
|
2011-11-08 16:19:52 +01:00
|
|
|
|
2012-07-11 21:40:35 +02:00
|
|
|
Syncing with Transifex
|
2011-11-08 16:19:52 +01:00
|
|
|
----------------------
|
|
|
|
|
2012-07-11 21:40:35 +02:00
|
|
|
We are using https://transifex.com as a frontend for translating the client.
|
2011-11-08 16:19:52 +01:00
|
|
|
|
2015-01-30 12:31:22 +01:00
|
|
|
https://www.transifex.com/projects/p/darkcoin/
|
2011-11-08 16:19:52 +01:00
|
|
|
|
2014-03-24 21:26:02 +01:00
|
|
|
The "Transifex client" (see: http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles)
|
2014-04-30 09:46:04 +02:00
|
|
|
is used to fetch new translations from Transifex. The configuration for this client (`.tx/config`)
|
2014-04-30 09:30:04 +02:00
|
|
|
is part of the repository.
|
2012-03-20 15:19:14 +01:00
|
|
|
|
2014-04-30 09:46:04 +02:00
|
|
|
Do not directly download translations one by one from the Transifex website, as we do a few
|
|
|
|
postprocessing steps before committing the translations.
|
2011-11-08 16:19:52 +01:00
|
|
|
|
|
|
|
### Fetching new translations
|
|
|
|
|
2014-04-30 09:46:04 +02:00
|
|
|
1. `python contrib/devtools/update-translations.py`
|
2012-03-20 15:19:14 +01:00
|
|
|
2. update `src/qt/bitcoin.qrc` manually or via
|
2015-01-30 12:31:22 +01:00
|
|
|
`ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(darkcoin_\(.*\)\).ts/<file alias="\2">locale\/\1.qm<\/file>/'`
|
2014-01-08 18:31:24 +01:00
|
|
|
3. update `src/qt/Makefile.am` manually or via
|
2015-01-30 12:31:22 +01:00
|
|
|
`ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(darkcoin_\(.*\)\).ts/ locale\/\1.ts \\/'`
|
2014-01-08 18:31:24 +01:00
|
|
|
4. `git add` new translations from `src/qt/locale/`
|