Changeset View
Changeset View
Standalone View
Standalone View
doc/translation_process.md
Show All 10 Lines | |||||
See the [Transifex Bitcoin project](https://www.transifex.com/projects/p/bitcoin/) to assist in translations. You should also join the translation mailing list for announcements - see details below. | See the [Transifex Bitcoin project](https://www.transifex.com/projects/p/bitcoin/) to assist in translations. You should also join the translation mailing list for announcements - see details below. | ||||
### Writing code with translations | ### Writing code with translations | ||||
We use automated scripts to help extract translations in both Qt, and non-Qt source files. It is rarely necessary to manually edit the files in `src/qt/locale/`. The translation source files must adhere to the following format: | We use automated scripts to help extract translations in both Qt, and non-Qt source files. It is rarely necessary to manually edit the files in `src/qt/locale/`. The translation source files must adhere to the following format: | ||||
`bitcoin_xx_YY.ts or bitcoin_xx.ts` | `bitcoin_xx_YY.ts or bitcoin_xx.ts` | ||||
`src/qt/locale/bitcoin_en.ts` is treated in a special way. It is used as the source for all other translations. Whenever a string in the source code is changed, this file must be updated to reflect those changes. A custom script is used to extract strings from the non-Qt parts. This script makes use of `gettext`, so make sure that utility is installed (ie, `apt-get install gettext` on Ubuntu/Debian). Once this has been updated, `lupdate` (included in the Qt SDK) is used to update `bitcoin_en.ts`. | `src/qt/locale/bitcoin_en.ts` is treated in a special way. It is used as the source for all other translations. Whenever a string in the source code is changed, this file must be updated to reflect those changes. A custom script is used to extract strings from the non-Qt parts. This script makes use of `gettext`, so make sure that utility is installed (ie, `apt-get install gettext` on Ubuntu/Debian). Once this has been updated, `lupdate` (included in the Qt SDK) is used to update `bitcoin_en.ts`. | ||||
To automatically regenerate the `bitcoin_en.ts` file, run the following commands: | To regenerate the `bitcoin_en.ts` file, run the following commands: | ||||
```sh | ```sh | ||||
cd src/ | cd <build-dir>/src/ | ||||
make translate | make translate | ||||
``` | ``` | ||||
`contrib/bitcoin-qt.pro` takes care of generating `.qm` (binary compiled) files from `.ts` (source files) files. It’s mostly automated, and you shouldn’t need to worry about it. | `contrib/bitcoin-qt.pro` takes care of generating `.qm` (binary compiled) files from `.ts` (source files) files. It’s mostly automated, and you shouldn’t need to worry about it. | ||||
**Example Qt translation** | **Example Qt translation** | ||||
```cpp | ```cpp | ||||
QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); | QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |