PDA

View Full Version : Automatic translation in qmake's project?



mchara
11th July 2008, 07:26
Hi, my problem may be unusual:
I have project that use subdirs project model and lupdate & lrelease doesn't work on it.
I want make pro files for subprojects in a way that building subprojects would also make translations.
I already have additional targets translate that does whole work.
The thing i can't figure out is how to force projects target to be dependent on additional target.

wysota
11th July 2008, 08:34
Can we see the project file?

mchara
11th July 2008, 08:52
I'm at work at the moment and i didn't copied updated pro file from home pc

its usual project with additional lines like

update.commands = lupdate hellotr.pro
updates.depends = $$SOURCES $$HEADERS $$FORMS $$TRANSLATIONS
release.commands = lrelease hellotr.pro
release.depends = update
translate.commands = $(COPY) *.qm ${DESTDIR}
translate.depends = release
QMAKE_EXTRA_TARGETS += update release translate

so make translate updates ts files, releases qms and copies them to destination directory
I want it to be done when normal make release / make debug is called.

i found that adding
POST_TARGETDEPS += translate
causes it works as i want, but qt documentation says that POST_TARGETDEPS may not work on some backends and looking for another way to do it without POST_TARGETDEPS portability limitations.

wysota
11th July 2008, 10:43
I would suggest using a custom target not related to make release or make debug. It doesn't make much sense to update (and above all to release) the translations during every compilation.

mchara
11th July 2008, 10:47
But if i use 'make translate' on subdirs template, 'translate' target will be passed to subproject's makes?

wysota
11th July 2008, 12:50
If you set the "recursive" option to translate.CONFIG then yes.

mchara
11th July 2008, 13:08
I've checked it and it works, thanks.

however i can't find it in any documentation...

wysota
11th July 2008, 15:11
Well... it's one of those undocumented things :) You can learn more by exploring our wiki.