]> Git Repo - VerusCoin.git/blame - doc/translation_process.md
Revised translation process doc
[VerusCoin.git] / doc / translation_process.md
CommitLineData
560078a7
NS
1Translations
2============
3
88eb44d3 4The Bitcoin-Core project has been designed to support multiple localisations. This makes adding new phrases, and completely new languages easily achievable. For managing all application translations, Bitcoin-Core makes use of the Transifex online translation management tool.
560078a7 5
88eb44d3
BJ
6### Helping to translate (using Transifex)
7Transifex is setup to monitor the Github repo for updates, and when code containing new translations is found, Transifex will process any changes. It may take several hours after a pull-request has been merged, to appear in the Transifex web interface.
560078a7 8
88eb44d3 9Multiple language support is critical in assisting Bitcoin’s global adoption, and growth. One of Bitcoin’s greatest strengths is cross-boarder money transfers, any help making that easier is greatly appreciated.
560078a7 10
88eb44d3 11See 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.
560078a7 12
88eb44d3
BJ
13### Writing code with translations
14We 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:
15`bitcoin_xx_YY.ts or bitcoin_xx.ts`
560078a7 16
88eb44d3 17`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`.
560078a7 18
88eb44d3
BJ
19To automatically regenerate the `bitcoin_en.ts` file, run the following commands:
20```sh
21cd src/
22make translate
fb51e282 23```
560078a7 24
88eb44d3 25`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.
560078a7 26
88eb44d3
BJ
27**Example Qt translation**
28```cpp
29QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
30```
560078a7 31
88eb44d3
BJ
32### Creating a pull-request
33For general PRs, you shouldn’t include any updates to the translation source files. They will be updated periodically, primarily around pre-releases, allowing time for any new phrases to be translated before public releases. This is also important in avoiding translation related merge conflicts.
560078a7 34
88eb44d3 35When an updated source file is merged into the Github repo, Transifex will automatically detect it (although it can take several hours). Once processed, the new strings will show up as "Remaining" in the Transifex web interface and are ready for translators.
560078a7 36
88eb44d3
BJ
37To create the pull-request, use the following commands:
38```
39git add src/qt/bitcoinstrings.cpp src/qt/locale/bitcoin_en.ts
40git commit
41```
dae7fff1 42
88eb44d3
BJ
43### Creating a Transifex account
44Visit the [Transifex Signup](https://www.transifex.com/signup/) page to create an account. Take note of your username and password, as they will be required to configure the command-line tool.
dae7fff1 45
88eb44d3 46You can find the Bitcoin translation project at [https://www.transifex.com/projects/p/bitcoin/](https://www.transifex.com/projects/p/bitcoin/).
dae7fff1 47
88eb44d3
BJ
48### Installing the Transifex client command-line tool
49The client it used to fetch updated translations. If you are having problems, or need more details, see [http://docs.transifex.com/developer/client/setup](http://docs.transifex.com/developer/client/setup)
dae7fff1 50
88eb44d3 51**For Linux and Mac**
dae7fff1 52
88eb44d3 53`pip install transifex-client`
dae7fff1 54
88eb44d3 55Setup your transifex client config as follows. Please *ignore the token field*.
560078a7 56
88eb44d3
BJ
57```ini
58nano ~/.transifexrc
560078a7 59
88eb44d3
BJ
60[https://www.transifex.com]
61hostname = https://www.transifex.com
62password = PASSWORD
63token =
64username = USERNAME
65```
560078a7 66
88eb44d3 67**For Windows**
560078a7 68
88eb44d3 69Please see [http://docs.transifex.com/developer/client/setup#windows](http://docs.transifex.com/developer/client/setup#windows) for details on installation.
2fac1028 70
88eb44d3 71The Transifex Bitcoin project config file is included as part of the repo. It can be found at `.tx/config`, however you shouldn’t need change anything.
560078a7 72
88eb44d3
BJ
73### Synchronising translations
74To assist in updating translations, we have created a script to help.
560078a7 75
9dd5d792 761. `python contrib/devtools/update-translations.py`
88eb44d3 772. Update `src/qt/bitcoin.qrc` manually or via
6d697e9f 78 `ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(bitcoin_\(.*\)\).ts/<file alias="\2">locale\/\1.qm<\/file>/'`
88eb44d3 793. Update `src/qt/Makefile.am` manually or via
6d697e9f
WL
80 `ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(bitcoin_\(.*\)\).ts/ locale\/\1.ts \\/'`
814. `git add` new translations from `src/qt/locale/`
88eb44d3
BJ
82
83**Do not directly download translations** one by one from the Transifex website, as we do a few post-processing steps before committing the translations.
84
85### Handling Plurals (in source files)
86When new plurals are added to the source file, it's important to do the following steps:
87
881. Open `bitcoin_en.ts` in Qt Linguist (included in the Qt SDK)
892. Search for `%n`, which will take you to the parts in the translation that use plurals
903. Look for empty `English Translation (Singular)` and `English Translation (Plural)` fields
914. Add the appropriate strings for the singular and plural form of the base string
925. Mark the item as done (via the green arrow symbol in the toolbar)
936. Repeat from step 2, until all singular and plural forms are in the source file
947. Save the source file
95
96### Translating a new language
97To create a new language template, you will need to edit the languages manifest file `src/qt/bitcoin.qrc` and add a new entry. Below is an example of the english language entry.
98
99```xml
100<qresource prefix="/translations">
101 <file alias="en">locale/bitcoin_en.qm</file>
102 ...
103</qresource>
104```
105
106**Note:** that the language translation file **must end in `.qm`** (the compiled extension), and not `.ts`.
107
108### Questions and general assistance
109The Bitcoin-Core translation maintainers include *tcatm, seone, Diapolo, wumpus and luke-jr*.You can find them, and others, in the Freenode IRC chatroom - `irc.freenode.net #bitcoin-dev`.
110
111If you are a translator, you should also subscribe to the mailing list, https://groups.google.com/forum/#!forum/bitcoin-translators. Announcements will be posted during application pre-releases to notify translators to check for updates.
This page took 0.1203 seconds and 4 git commands to generate.