You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

translation_process.md 3.2KB

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