Skip to content
Wade821 edited this page Apr 24, 2019 · 9 revisions

This is a guide to adding or updating translations for Drawpile.

Drawpile loads the translation for the current preferred language of the operating system, or the language selected from the settings dialog. If no translations for the selected language are available, the default English text will be used.

Installing the translation tools

Translation files are edited with Qt Linguist.

On Linux, linguist-qt5 is usually available in the distro repositories:

  • Fedora: dnf install qt5-qttools-devel
  • Archlinux: pacman -S qt5-tools
  • Debian & Ubuntu: apt-get install qttools5-dev-tools
  • OpenSUSE: zypper install libqt5-linguist

On Windows and Mac OS X, install the Qt SDK from qt.io. Linguist is included as part of the Qt Creator IDE.

For the convenience of those Windows users who do not want to download hundreds of megabytes worth of tools they will not need, you can get just the Linguist executable extracted from the SDK package. Simply unpack it into Drawpile's directory to use.

An alternative download source has the Linguist program necessary for translations as well for download. As this is a third party resource, feel free to check the files for safety using a service like VirusTotal.com or with your own local antivirus, though they should be safe to use as the file linguist_5.12.3.zip passed scanning results of 63 antivirus services as of the 24th of April, 2019.

Getting latest Drawpile sources

The best way to get the most up to date version of Drawpile's source code is to use Git and clone the repository. Another option is to download the latest master branch package.

Having the full source code is not strictly required, but it will help because you will be able to see the context in which the words and phrases are used.

Starting a new translation

Translation files are located in the source code directory src/client/i18n/. The easiest way to start a translation is to just make a copy of an existing one and modify that after saving it with an updated name. The file should be named drawpile_XX.ts, where XX is a two letter ISO-639-1 language code. If you are creating a translation for a new language, first go to Edit->Translation file settings and set the correct language and country. Be aware that this file will not be empty and may make things harder to track in terms of completed translations (as noted in the Modifying translations section). Creating empty translations can be done in one of two ways listed below.

If you have the development tools installed, a better way is to use lupdate to create an empty translation file. For example, running lupdate-qt5 .. -recursive -ts drawpile_ru.ts in the i18n source directory will produce a new file drawpile_ru.ts ready for translating. If you're using the Linguist program from the third party resource mentioned earlier, with Drawpile-master source code extracted into the Linguist folder in your downloads, these example commands could work.

  • cd /D "%userprofile%\Downloads\linguist"
  • lupdate "%userprofile%\Downloads\Drawpile-master\src\client\i18n\drawpile_ru.ts" -silent -recursive -ts "%userprofile%\Downloads\Drawpile-master\src\client\i18n\drawpile_fr.ts"

An alternate method has been provided for Windows users with simplified steps. It simply requires the most recent version of Linguist as made available from a third party resource mentioned earlier. With those files extracted, download the "Script - Create Empty Translation File.bat" and make sure that this script is located also within the linguist folder as it must be in the same location for it to work. Then double click the script to run it and follow the prompts from the script.

Modifying translations

Open the .ts file with Qt Linguist. Generally speaking, you can mark a phrase as translated by selecting the "?" symbol under the "Strings" window to change to a green checkmark. This will make it easier to review in the future as new items to be translated will have a yellow question mark.

For more information on these symbols, read Selecting Context to Translate and Selecting String to Translate. The translators section of Qt Linguist's manual contains lots of useful tips and instructions.

Updating a Translation in Progress

Drawpile may update before you can finish translating the code. An example of this is that you downloaded the source code for Drawpile 2.1.2, but it recently updated to 2.1.5. New features in Drawpile will not be available to be translated, unless you update your translation file to contain the phrases to be translated or start over from scratch. Given at this time there are over 800 phrases to translate, this is time consuming.

If you have the development tools installed , a better way is to use lupdate to update your translation file. For example, running lupdate-qt5 ../Drawpile-master/src/client ../Drawpile-master/src/desktop -recursive -no-obsolete -ts drawpile_ru.ts in the i18n source directory will update your existing file drawpile_ru.ts with new phrases to be translated. If you're using the Linguist program from the third party resource mentioned earlier, with updated Drawpile-master source code extracted into the Linguist folder in your downloads, these example commands could work.

  • cd /D "%userprofile%\Downloads\linguist"
  • lupdate "%userprofile%\Downloads\Drawpile-master\src\client" "%userprofile%\Downloads\Drawpile-master\src\desktop" -recursive -no-obsolete -ts "%userprofile%\Downloads\Drawpile-master\src\client\i18n\drawpile_ru.ts"

To update the file, a script has been provided for Windows users with simplified steps. Use the most recent version of Linguist as made available from a third party resource mentioned earlier and Git which can be downloaded here. Install it with all default features, as it is used to automatically download the Drawpile Source code. Download the "Script - Update Translation File.bat" and make sure that this script is located also within the linguist folder as it must be in the same location for it to work. Then double click the script to run it and follow the prompts from the script. Again, the script should only be used if you were in the middle of translating and an updated version of Drawpile was released.

Testing and contributing translations

Save a release version of the translation file to Drawpile's i18n/ directory using the File->Release as... menu action. The location of this directory depends on the platform:

  • Linux: Typically in /usr/local/share/drawpile/drawpile/ (or in the same folder as the binary)
  • Windows: In the same folder as the executable (usually C:\Program files\Drawpile\)
  • OSX: Inside the app bundle

Make sure your operating system language is set to the target language, or select the language explicitly from Drawpile's settings dialog and (re)start Drawpile. It should now use your translation!

When you are satisfied with it, you can send the translation file (note: the .ts file, not the .qm file) to me by e-mail or, if you have a Github account, make a pull request.

Clone this wiki locally