[Resolved]How to generate .qm files automatically from .ts files?
-
I use Visual Studio 2008 to create an application using Qt. I've generate .ts files for internationalization. I want when compiling the application, generate the .qm files from .ts one. Currently I manage to generate but not when compiling my app. It is by right click on the project and selecting "lrelease all .ts in project". What I don't want. I want to automatically generate* .qm* files during compilation.
How can I do it?
Thank you in advance for your help.
-
You can add this line to your .pro file:
@
QMAKE_POST_LINK = lrelease myProjectName.pro
@This requires $QTDIR/bin to be in $PATH.
-
Thank you 'sierdzio" for your answer. But I don't have a .pro file. It is a .vproj file.
-
Bad luck ;)
Use some Visual Studio magic, then, to add a line that will execute lrelease for you, before or after the compilation.
-
In the Qt Project Settings for your project you will find an option called lupdateOnBuild - that may do what you need but I have not tried it
-
Use Custom Build Step or Post-Build Event.
-
Thank you everybody. I have resolved the problem. This is what I've done:
-
Right click on the project
-
Click on the Properties menu
-
At the tree on the left of the window that appears, expand the node "Configuration Properties"
-
Expand the node "Build Event"
-
Then click on the node "Pre -Build Event"
-
At the box that appears right, after the click on " Pre -Build Event " menu, click the "Command Line " line. Then click the small button with three dots to the right to edit the area where we must enter the commands.
-
At this area which is displayed after clicking on the small button , enter the following commands:
@$ lrelease ( InputDir ) \ myapplicationName_fr_FR.ts - qm $ ( OutDir ) \ myapplicationName_fr_FR.qm
$ lrelease ( InputDir ) \ myapplicationName_en.ts - qm $ ( OutDir ) \ myapplicationName_en.qm@ -
Click the "OK" button to save . You can now compile your application and .qm files will be generated
-
-
An other solution:
Right-click> Properties on of the .ts files
choose for the field Configuration: "All Configuration" value
Then click on the node Custom Build Step and enter the following commands for the fieldsat the right:
@Command Line : "$(QTDIR)\bin\lrelease.exe" "$(InputPath)" -qm "$(OutDir)$(InputName).qm"
Description: LReleasing $(InputFileName)...
Outputs : "$(OutDir)$(InputName).qm"
Additional dependencies : "$(QTDIR)\bin\lrelease.exe"@
Repeat the steps 1,2 and 3 for all the .ts files
-
thank you!