Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Resolved]How to generate .qm files automatically from .ts files?
Forum Updated to NodeBB v4.3 + New Features

[Resolved]How to generate .qm files automatically from .ts files?

Scheduled Pinned Locked Moved General and Desktop
9 Posts 5 Posters 16.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SamFaye
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can add this line to your .pro file:
      @
      QMAKE_POST_LINK = lrelease myProjectName.pro
      @

      This requires $QTDIR/bin to be in $PATH.

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SamFaye
        wrote on last edited by
        #3

        Thank you 'sierdzio" for your answer. But I don't have a .pro file. It is a .vproj file.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Bad luck ;)

          Use some Visual Studio magic, then, to add a line that will execute lrelease for you, before or after the compilation.

          (Z(:^

          1 Reply Last reply
          0
          • G Offline
            G Offline
            GrahamL
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • S Offline
              S Offline
              ScottR
              wrote on last edited by
              #6

              Use Custom Build Step or Post-Build Event.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SamFaye
                wrote on last edited by
                #7

                Thank you everybody. I have resolved the problem. This is what I've done:

                1. Right click on the project

                2. Click on the Properties menu

                3. At the tree on the left of the window that appears, expand the node "Configuration Properties"

                4. Expand the node "Build Event"

                5. Then click on the node "Pre -Build Event"

                6. 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.

                7. 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@

                8. Click the "OK" button to save . You can now compile your application and .qm files will be generated

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SamFaye
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  • O Offline
                    O Offline
                    opengpu2
                    wrote on last edited by
                    #9

                    thank you!

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved