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. Check for QTranslator::load
Forum Updated to NodeBB v4.3 + New Features

Check for QTranslator::load

Scheduled Pinned Locked Moved Solved General and Desktop
25 Posts 6 Posters 2.9k Views 3 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #15

    No, the .qrc raw content.

    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

      No, the .qrc raw content.

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

      @SGaist
      Screenshot_2.png

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

        From there it looks all good.

        Just for the sake of debugging, you should check the install and remove calls since they return a Boolean.

        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

          From there it looks all good.

          Just for the sake of debugging, you should check the install and remove calls since they return a Boolean.

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

          @SGaist I checked them and they are working fine but after deployment they don't unless I add .qm file to the directory.

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

            Did you try to list the content of the .qrc file using QDir at run time just to ensure you have everything in place ?

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

            H 2 Replies Last reply
            0
            • nageshN Offline
              nageshN Offline
              nagesh
              wrote on last edited by
              #20

              @hbatalha
              I feel you missed the second argument for the load function which is the directory path, where as first is the filename.

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

              If directory is not specified, the current directory is used (i.e., as currentPath()).
              So in deployment it will search for current path for the .qm file.

              H 1 Reply Last reply
              1
              • SGaistS SGaist

                Did you try to list the content of the .qrc file using QDir at run time just to ensure you have everything in place ?

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

                @SGaist said in Check for QTranslator::load:

                Did you try to list the content of the .qrc file using QDir at run time just to ensure you have everything in place ?

                I will do that and get back to you

                1 Reply Last reply
                0
                • nageshN nagesh

                  @hbatalha
                  I feel you missed the second argument for the load function which is the directory path, where as first is the filename.

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

                  If directory is not specified, the current directory is used (i.e., as currentPath()).
                  So in deployment it will search for current path for the .qm file.

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

                  @nagesh but I am loading from resource file, it shouldn't care for the directory of the .qm file in the deployment since the resource files are supposed to be compiled into the .exe file

                  J.HilkJ 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Did you try to list the content of the .qrc file using QDir at run time just to ensure you have everything in place ?

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

                    @SGaist

                    Did you try to list the content of the .qrc file using QDir at run time just to ensure you have everything in place ?

                    I did, everything seems to fine.

                    I don't know where I can possibly be doing something wrong. I created another topic dedicated to this problem as this one contains answer that solves the op.

                    1 Reply Last reply
                    0
                    • H hbatalha

                      @nagesh but I am loading from resource file, it shouldn't care for the directory of the .qm file in the deployment since the resource files are supposed to be compiled into the .exe file

                      J.HilkJ Online
                      J.HilkJ Online
                      J.Hilk
                      Moderators
                      wrote on last edited by
                      #24

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

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

                        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
                        2

                        • Login

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