How to generate a single translation file for a large Qt project?
-
11-09-2019 - |
Question
I have a large project with one qmake project file defining all project components using a 'subdirs' template. Currently I define translation files in the qmake files of each sub-project. This results in separate translation files for each sub-project, which quickly becomes too cumbersome to maintain.
How do I get lupdate to produce a single translation file containing all translation strings for all of the sub-projects?
Solution
First of all split all your pro files into pro and pri files. Then put all the pri files into one global pro file and generate the language file for that pro file.
Special language pro file looks like this:
TEMPLATE = app
DEPENDPATH += Proj1 Proj2 Proj3
include(Proj1/Proj1.pri)
include(Proj2/Proj2.pri)
include(Proj3/Proj3.pri)
TRANSLATIONS = en.ts fr.ts it.main.ts ja.main.ts nl.main.ts
A script can easily generate this project language file for you.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow