dash/doc/translation_process.md

90 lines
3.2 KiB
Markdown
Raw Permalink Normal View History

2011-11-08 16:19:52 +01:00
Translations
============
2015-04-03 00:51:08 +02:00
The Dash Core 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
-----------------
### dash-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/dash.qrc
2011-11-08 16:19:52 +01:00
This file must be updated whenever a new translation is added. Please note that
files must end with `.qm`, not `.ts`.
2014-09-04 12:45:28 +02:00
```xml
<qresource prefix="/translations">
2015-04-03 00:51:08 +02:00
<file alias="en">locale/dash_en.qm</file>
2014-09-04 12:45:28 +02:00
...
</qresource>
```
2011-11-08 16:19:52 +01:00
### src/qt/locale/
This directory contains all translations. Filenames must adhere to this format:
dash_xx_YY.ts or dash_xx.ts
2011-11-08 16:19:52 +01:00
#### dash_en.ts (Source file)
2011-11-08 16:19:52 +01:00
`src/qt/locale/dash_en.ts` is treated in a special way. It is used as the
source for all other translations. Whenever a string in the 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
2015-04-15 01:14:56 +02:00
Ubuntu/Debian). Once this has been updated, lupdate (included in the Qt SDK)
is used to update dash_en.ts. This process has been automated, from src/,
simply run:
make translate
##### Handling of plurals in the source file
When new plurals are added to the source file, it's important to do the following steps:
1. Open dash_en.ts in Qt Linguist (also included in the Qt SDK)
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:
git add src/qt/dashstrings.cpp src/qt/locale/dash_en.ts
git commit
2011-11-08 16:19:52 +01:00
Syncing with Transifex
2011-11-08 16:19:52 +01:00
----------------------
We are using https://transifex.com as a frontend for translating the client.
2011-11-08 16:19:52 +01:00
https://www.transifex.com/projects/p/dash/
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)
is used to fetch new translations from Transifex. The configuration for this client (`.tx/config`)
is part of the repository.
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
1. `python contrib/devtools/update-translations.py`
2. update `src/qt/dash.qrc` manually or via
`ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(dash_\(.*\)\).ts/ <file alias="\2">locale\/\1.qm<\/file>/'`
2015-04-03 00:51:08 +02:00
3. update `src/Makefile.qt.include` manually or via
`ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(dash_\(.*\)\).ts/ qt\/locale\/\1.ts \\/'`
4. `git add` new translations from `src/qt/locale/`