Translating

Calle Laakkonen edited this page Jul 17, 2016 · 3 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.

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 stable-1.x 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. The file should be named drawpile_XX.ts, where XX is a two letter ISO-639-1 language code.

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.

Modifying translations

Open the .ts file with Qt Linguist. If you are creating a translation for a new language, first go to Edit->Translation file settings and set the correct language and country.

The translators section of Qt Linguist's manual contains lots of useful tips and instructions.

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.