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. Translations not working after deployment
Forum Updated to NodeBB v4.3 + New Features

Translations not working after deployment

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 5 Posters 1.4k 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @hbatalha said in Translations not working after deployment:

    I thought that all the files in the resource file are compiled into the .exe but it is not happening with the .qm file as all the other files added in the resource seem to be working fine.

    They are. But your qm-file is in your binary dir whereas the rest is in your source dir so make sure the correct qm file is icked up. Also check with QFile::exists() if the qm file is available.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    H 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      @hbatalha said in Translations not working after deployment:

      I thought that all the files in the resource file are compiled into the .exe but it is not happening with the .qm file as all the other files added in the resource seem to be working fine.

      They are. But your qm-file is in your binary dir whereas the rest is in your source dir so make sure the correct qm file is icked up. Also check with QFile::exists() if the qm file is available.

      H Offline
      H Offline
      hbatalha
      wrote on last edited by
      #3

      @Christian-Ehrlicher

      your qm-file is in your binary dir whereas the rest is in your source dir

      What do you you mean? They are all in the same folder.

      Also check with QFile::exists() if the qm file is available.

      The load operation is successful, doesn't that mean the file exists?

      J.HilkJ Christian EhrlicherC 2 Replies Last reply
      0
      • H hbatalha

        @Christian-Ehrlicher

        your qm-file is in your binary dir whereas the rest is in your source dir

        What do you you mean? They are all in the same folder.

        Also check with QFile::exists() if the qm file is available.

        The load operation is successful, doesn't that mean the file exists?

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #4

        @J-Hilk said in Check for QTranslator::load:

        @hbatalha
        what @nagesh meant is:

        translatorPt.load("transl_portuguese.qm", ":/Languages/"))

        file path is now your qrc system and not currentPath


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        H 1 Reply Last reply
        0
        • H hbatalha

          @Christian-Ehrlicher

          your qm-file is in your binary dir whereas the rest is in your source dir

          What do you you mean? They are all in the same folder.

          Also check with QFile::exists() if the qm file is available.

          The load operation is successful, doesn't that mean the file exists?

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #5

          @hbatalha said in Translations not working after deployment:

          The load operation is successful, doesn't that mean the file exists?

          but after deployment it doesn't.

          What now?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • kkoehneK Offline
            kkoehneK Offline
            kkoehne
            Moderators
            wrote on last edited by
            #6

            @hbatalha said in Translations not working after deployment:

            I thought that all the files in the resource file are compiled into the .exe but it is not happening with the .qm file as all the other files added in the resource seem to be working fine.

            Please show us your QTranslator::load() call. You most likely need to tweak it to actually load the .qm file's content from the resource system...

            Director R&D, The Qt Company

            H 1 Reply Last reply
            0
            • kkoehneK kkoehne

              @hbatalha said in Translations not working after deployment:

              I thought that all the files in the resource file are compiled into the .exe but it is not happening with the .qm file as all the other files added in the resource seem to be working fine.

              Please show us your QTranslator::load() call. You most likely need to tweak it to actually load the .qm file's content from the resource system...

              H Offline
              H Offline
              hbatalha
              wrote on last edited by
              #7

              @kkoehne

              Please show us your QTranslator::load() call.

              if( ! translatorPt.load(":/Languages/transl_portuguese.qm"))
                      qDebug() << "not loaded";
              
              J.HilkJ 1 Reply Last reply
              0
              • H hbatalha

                @kkoehne

                Please show us your QTranslator::load() call.

                if( ! translatorPt.load(":/Languages/transl_portuguese.qm"))
                        qDebug() << "not loaded";
                
                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #8

                @hbatalha
                due, for the 3rd time

                translatorPt.load("transl_portuguese.qm", ":/Languages"))
                

                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                1 Reply Last reply
                0
                • J.HilkJ J.Hilk

                  @J-Hilk said in Check for QTranslator::load:

                  @hbatalha
                  what @nagesh meant is:

                  translatorPt.load("transl_portuguese.qm", ":/Languages/"))

                  file path is now your qrc system and not currentPath

                  H Offline
                  H Offline
                  hbatalha
                  wrote on last edited by
                  #9

                  @J-Hilk I supected that was what he meant so I tried that but didn't work also.

                  J.HilkJ 1 Reply Last reply
                  0
                  • H hbatalha

                    @J-Hilk I supected that was what he meant so I tried that but didn't work also.

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #10

                    @hbatalha
                    check out this thread
                    https://forum.qt.io/topic/74995/load-qm-file-from-resource/15

                    the op never responded after a couple of solution suggestions, I assume one of them works 🤷‍♂️


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      hbatalha
                      wrote on last edited by
                      #11

                      I have found out what was the problem. For some reason I don't know every time I build the application Qt Creator will create the binary in the debug folder even though I have it set to release.

                      None of the changes I was making was actually taking effect since I was always checking .exe file from the release which was remaining unchanged the whole time.

                      So I took the .exe from the debug folder and deployed it and all is working fine. Now I have to check what might me going when building my app cause the .exe is pretty big and I am not sure if is the release or the debug(it is in the debug folder, but I built it with release build set).

                      I thank you all for the time and patience. I really appreciated it.

                      1 Reply Last reply
                      1
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        Any chances you are on Windows ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        H 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Any chances you are on Windows ?

                          H Offline
                          H Offline
                          hbatalha
                          wrote on last edited by
                          #13

                          @SGaist

                          Any chances you are on Windows ?

                          Yeah I am on Windows 10 64 bit

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            Using Visual Studio ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            H 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Using Visual Studio ?

                              H Offline
                              H Offline
                              hbatalha
                              wrote on last edited by
                              #15

                              @SGaist No, Qt Creator

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #16

                                I mean the compiler.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                H 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  I mean the compiler.

                                  H Offline
                                  H Offline
                                  hbatalha
                                  wrote on last edited by hbatalha
                                  #17

                                  @SGaist oh, it is mingw64 from msys2.

                                  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