4

The following questions focus on the same issue, which is translation some Qt inner Words:

Title:Qt: how to translate the buttons in qmessagebox?

Translations of QMessageBox not work in Qt5.3

Qt Dynamic translation of dialog windows

I searched in here and found (at C:\Qt\Qt5.3.2\Tools\QtCreator\share\qtcreator\translations) there is no translation file for brazil/portuguese.

How can I create and contribute one of this files?

Community
  • 1
  • 1
KcFnMi
  • 5,516
  • 10
  • 62
  • 136

2 Answers2

5

TL;DR Use Qt Linguist to create translation files.

The whole process of application translation:

  1. At first you have to prepare your app for translation by marking strings which you want to translate: Writing Source Code for Translation
  2. Translate the application with Qt Linguist: Qt Linguist Manual
  3. Load translation files with application: Hello tr() Example or How to create a multi language application
Chnossos
  • 9,971
  • 4
  • 28
  • 40
emKaroly
  • 756
  • 1
  • 10
  • 22
1

Add translations to the project

At first you have to prepare your app for translation by marking strings which you want to translate:

tr()

In your qmake project file, the following variable TRANSLATIONS has to be added and must contain all language files you want to create initially.

TRANSLATIONS = languages/TranslationExample_en.ts >languages/TranslationExample_de.ts

You will find lupdate and lrelese int the QT Creater at: Extras-> extern -> linguist

By calling lupdate

lupdate -verbose TranslationExample.pro You create the language files (.ts), which you translate by using the tool Qt >Linguist. linguist languages/TranslationExample_en.ts languages/TranslationExample_de.ts

After doing this, you call lrelease to create the binary language files (.qm):

lrelease TranslationExample.pro

You will find this manual as a long version :

http://wiki.qt.io/How_to_create_a_multi_language_application

Dacown
  • 19
  • 2