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. How to load translation for static library widget

How to load translation for static library widget

Scheduled Pinned Locked Moved Solved General and Desktop
qtranslatorstatic library
32 Posts 5 Posters 14.3k Views
  • 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.
  • A AlterX
    7 Jan 2016, 12:16

    @mbnoimi

    hi,
    theoretically if your lib is static (e.g. *.a or *.lib in win) that will be linked alongside the application that is using the lib.
    Then, just use QApplication::translate(...) with the correct context and it will work.

    M Offline
    M Offline
    mbnoimi
    wrote on 7 Jan 2016, 13:29 last edited by
    #3

    @AlterX

    theoretically if your lib is static (e.g. *.a or *.lib in win) that will be linked alongside the application that is using the lib.
    Then, just use QApplication::translate(...) with the correct context and it will work.

    Thanks, but this is not related to my question!
    I already successfully created translation for the library but I don't know how to load it when I call the widget

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 8 Jan 2016, 08:45 last edited by
      #4

      Hi,

      You can use QTranslator like shown in the documentation. The fact that you don't do it in main is irrelevant. The only thing that you must ensure is that your widgets handle dynamic translation properly.

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

      M 1 Reply Last reply 9 Jan 2016, 10:51
      0
      • S SGaist
        8 Jan 2016, 08:45

        Hi,

        You can use QTranslator like shown in the documentation. The fact that you don't do it in main is irrelevant. The only thing that you must ensure is that your widgets handle dynamic translation properly.

        M Offline
        M Offline
        mbnoimi
        wrote on 9 Jan 2016, 10:51 last edited by mbnoimi 1 Sept 2016, 10:55
        #5

        @SGaist said:

        You can use QTranslator like shown in the documentation. The fact that you don't do it in main is irrelevant. The only thing that you must ensure is that your widgets handle dynamic translation properly.

        I didn't mention calling from main() !

        My question is quite simple. How can I load *.qm from static library resource? as you can see below I can load *.qm easily from current project resource by using ":/"

        myTranslator->load(*local, QLatin1String("tester"), QLatin1String("_"), QLatin1String(":/i18n"))
        

        I aim to load translation from static library to be able to apply multiple translations as mentioned in QTranslator doc

        K 1 Reply Last reply 9 Jan 2016, 13:24
        0
        • M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 9 Jan 2016, 11:38 last edited by
          #6

          Hi
          Maybe try

          QDirIterator it(":", QDirIterator::Subdirectories);
              while (it.hasNext()) {
                  qDebug() << it.next();
              }
          

          to have a look how the files are named in the running exe to to verify
          that they are indeed under ":/i18n" and paths are as you expect.

          M 1 Reply Last reply 10 Jan 2016, 12:17
          0
          • M mbnoimi
            9 Jan 2016, 10:51

            @SGaist said:

            You can use QTranslator like shown in the documentation. The fact that you don't do it in main is irrelevant. The only thing that you must ensure is that your widgets handle dynamic translation properly.

            I didn't mention calling from main() !

            My question is quite simple. How can I load *.qm from static library resource? as you can see below I can load *.qm easily from current project resource by using ":/"

            myTranslator->load(*local, QLatin1String("tester"), QLatin1String("_"), QLatin1String(":/i18n"))
            

            I aim to load translation from static library to be able to apply multiple translations as mentioned in QTranslator doc

            K Offline
            K Offline
            kshegunov
            Moderators
            wrote on 9 Jan 2016, 13:24 last edited by
            #7

            @mbnoimi

            My question is quite simple. How can I load *.qm from static library resource? as you can see below I can load *.qm easily from current project resource by using ":/"

            You're asking the wrong question. Actually @SGaist and @AlterX have provided valuable feedback and you'd be wise to take it into account. I peeked into your repository and I'm pretty sure you're creating your translator wrongly. Did you notice this warning: "Note that the translator must be created before the application's widgets." in the documentation?

            Kind regards.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 9 Jan 2016, 20:50 last edited by
              #8

              To add to @kshegunov , the note concerns the use of QTranslator shown in the example i.e. setup of the language at application startup and no support of dynamic translations.

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

              K M 2 Replies Last reply 9 Jan 2016, 22:10
              0
              • S SGaist
                9 Jan 2016, 20:50

                To add to @kshegunov , the note concerns the use of QTranslator shown in the example i.e. setup of the language at application startup and no support of dynamic translations.

                K Offline
                K Offline
                kshegunov
                Moderators
                wrote on 9 Jan 2016, 22:10 last edited by
                #9

                @SGaist
                Oh, yes, you're surely correct I forgot to check for the changeEvent() override in his code :S Still I don't see anything wrong with the translation loading by itselt.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • S SGaist
                  9 Jan 2016, 20:50

                  To add to @kshegunov , the note concerns the use of QTranslator shown in the example i.e. setup of the language at application startup and no support of dynamic translations.

                  M Offline
                  M Offline
                  mbnoimi
                  wrote on 10 Jan 2016, 10:37 last edited by
                  #10

                  @SGaist said:

                  To add to @kshegunov , the note concerns the use of QTranslator shown in the example i.e. setup of the language at application startup and no support of dynamic translations.

                  How the application doesn't support dynamic translations? Take a look into this line it calls changeEvent and if you run the app. you'll find that Tester loads the translations dynamically correctly while it doesn't call translations for static library widget because I don't know how to do it!

                  K 1 Reply Last reply 10 Jan 2016, 10:46
                  0
                  • M Offline
                    M Offline
                    mbnoimi
                    wrote on 10 Jan 2016, 10:43 last edited by mbnoimi 1 Oct 2016, 11:02
                    #11

                    I tried to use Q_INIT_RESOURCE as mentioned in this line but unfortunately it makes things worst.

                    1 Reply Last reply
                    0
                    • M mbnoimi
                      10 Jan 2016, 10:37

                      @SGaist said:

                      To add to @kshegunov , the note concerns the use of QTranslator shown in the example i.e. setup of the language at application startup and no support of dynamic translations.

                      How the application doesn't support dynamic translations? Take a look into this line it calls changeEvent and if you run the app. you'll find that Tester loads the translations dynamically correctly while it doesn't call translations for static library widget because I don't know how to do it!

                      K Offline
                      K Offline
                      kshegunov
                      Moderators
                      wrote on 10 Jan 2016, 10:46 last edited by kshegunov 1 Oct 2016, 10:52
                      #12

                      @mbnoimi

                      How the application doesn't support dynamic translations?

                      He was referring to the note in the documentation I was citing, and was explaining that it is only relevant when there is no support for dynamic translation.

                      it doesn't call translations for static library widget because I don't know how to do it!

                      You do it, like you're doing it now. Here's the thing, a static library is nothing more then a bunch of .obj files put together. Linking a static library just includes them into your application's binary. This means, that there is nothing different between widgets that come from a static library and these declared in your application (see @AlterX's comment, he mentioned that). That's why I said you're asking the wrong question. Your translation loading looks perfectly fine to me, and it has nothing to do with static or dynamic libraries - you need to look elsewhere to solve the problem. Do you have any output in the creator's windows that might suggest your translation is not loaded? Do you get the "Failed to load a translation for QT in your local language" message printed?

                      I tried to use Q_INIT_RESOURCE as mentioned in this line but unfortunately it makes things worst.

                      Yes you should do that for all the resources in your static library. But according to this it should be placed in the beginning of main().

                      Kind regards.

                      Read and abide by the Qt Code of Conduct

                      M 2 Replies Last reply 10 Jan 2016, 10:52
                      0
                      • K kshegunov
                        10 Jan 2016, 10:46

                        @mbnoimi

                        How the application doesn't support dynamic translations?

                        He was referring to the note in the documentation I was citing, and was explaining that it is only relevant when there is no support for dynamic translation.

                        it doesn't call translations for static library widget because I don't know how to do it!

                        You do it, like you're doing it now. Here's the thing, a static library is nothing more then a bunch of .obj files put together. Linking a static library just includes them into your application's binary. This means, that there is nothing different between widgets that come from a static library and these declared in your application (see @AlterX's comment, he mentioned that). That's why I said you're asking the wrong question. Your translation loading looks perfectly fine to me, and it has nothing to do with static or dynamic libraries - you need to look elsewhere to solve the problem. Do you have any output in the creator's windows that might suggest your translation is not loaded? Do you get the "Failed to load a translation for QT in your local language" message printed?

                        I tried to use Q_INIT_RESOURCE as mentioned in this line but unfortunately it makes things worst.

                        Yes you should do that for all the resources in your static library. But according to this it should be placed in the beginning of main().

                        Kind regards.

                        M Offline
                        M Offline
                        mbnoimi
                        wrote on 10 Jan 2016, 10:52 last edited by
                        #13

                        @kshegunov

                        Do you have any output in the creator's windows that might suggest your translation is not loaded?

                        No

                        Do you get the "Failed to load a translation for QT in your local language" message printed?

                        No. I get Failed to load translation from static library error message!

                        1 Reply Last reply
                        0
                        • K kshegunov
                          10 Jan 2016, 10:46

                          @mbnoimi

                          How the application doesn't support dynamic translations?

                          He was referring to the note in the documentation I was citing, and was explaining that it is only relevant when there is no support for dynamic translation.

                          it doesn't call translations for static library widget because I don't know how to do it!

                          You do it, like you're doing it now. Here's the thing, a static library is nothing more then a bunch of .obj files put together. Linking a static library just includes them into your application's binary. This means, that there is nothing different between widgets that come from a static library and these declared in your application (see @AlterX's comment, he mentioned that). That's why I said you're asking the wrong question. Your translation loading looks perfectly fine to me, and it has nothing to do with static or dynamic libraries - you need to look elsewhere to solve the problem. Do you have any output in the creator's windows that might suggest your translation is not loaded? Do you get the "Failed to load a translation for QT in your local language" message printed?

                          I tried to use Q_INIT_RESOURCE as mentioned in this line but unfortunately it makes things worst.

                          Yes you should do that for all the resources in your static library. But according to this it should be placed in the beginning of main().

                          Kind regards.

                          M Offline
                          M Offline
                          mbnoimi
                          wrote on 10 Jan 2016, 11:01 last edited by
                          #14

                          @kshegunov said:

                          according to this it should be placed in the beginning of main().

                          I did that... still get same behavior.

                          K 1 Reply Last reply 10 Jan 2016, 11:10
                          0
                          • M mbnoimi
                            10 Jan 2016, 11:01

                            @kshegunov said:

                            according to this it should be placed in the beginning of main().

                            I did that... still get same behavior.

                            K Offline
                            K Offline
                            kshegunov
                            Moderators
                            wrote on 10 Jan 2016, 11:10 last edited by kshegunov 1 Oct 2016, 11:11
                            #15

                            Hello,
                            Something is amiss here, let's take it from the top. You said that you get the "Failed to load a translation for QT in your local language" message, but this message is to be shown when this fails:

                                myTranslator->load(*local, QLatin1String("tester"), QLatin1String("_"), QLatin1String(":/i18n"))
                            

                            This particular line is in your application and tries to load an application translation, where does a static library resource come in play here? Could you tell what is the current language you're using and its iso code (you could use QLocale::language() and QLocale::languageToString), and make sure there's a matching translation file?

                            Kind regards.

                            Read and abide by the Qt Code of Conduct

                            M 1 Reply Last reply 10 Jan 2016, 11:26
                            0
                            • K kshegunov
                              10 Jan 2016, 11:10

                              Hello,
                              Something is amiss here, let's take it from the top. You said that you get the "Failed to load a translation for QT in your local language" message, but this message is to be shown when this fails:

                                  myTranslator->load(*local, QLatin1String("tester"), QLatin1String("_"), QLatin1String(":/i18n"))
                              

                              This particular line is in your application and tries to load an application translation, where does a static library resource come in play here? Could you tell what is the current language you're using and its iso code (you could use QLocale::language() and QLocale::languageToString), and make sure there's a matching translation file?

                              Kind regards.

                              M Offline
                              M Offline
                              mbnoimi
                              wrote on 10 Jan 2016, 11:26 last edited by
                              #16

                              @kshegunov said:

                              Hello,
                              Something is amiss here, let's take it from the top. You said that you get the "Failed to load a translation for QT in your local language" message, but this message is to be shown when this fails: myTranslator->load(*local, QLatin1String("tester"), QLatin1String("_"), QLatin1String(":/i18n"))

                              I didn't say that!
                              I said I get Failed to load translation from static library which points to myTranslator->load(":/languages/arabic") failure!

                              where does a static library resource come in play here?

                              As I mentioned above this line suppose to load translation from static library's resource

                              Could you tell what is the current language you're using and its iso code

                              English; en_US

                              K 1 Reply Last reply 10 Jan 2016, 11:49
                              0
                              • M mbnoimi
                                10 Jan 2016, 11:26

                                @kshegunov said:

                                Hello,
                                Something is amiss here, let's take it from the top. You said that you get the "Failed to load a translation for QT in your local language" message, but this message is to be shown when this fails: myTranslator->load(*local, QLatin1String("tester"), QLatin1String("_"), QLatin1String(":/i18n"))

                                I didn't say that!
                                I said I get Failed to load translation from static library which points to myTranslator->load(":/languages/arabic") failure!

                                where does a static library resource come in play here?

                                As I mentioned above this line suppose to load translation from static library's resource

                                Could you tell what is the current language you're using and its iso code

                                English; en_US

                                K Offline
                                K Offline
                                kshegunov
                                Moderators
                                wrote on 10 Jan 2016, 11:49 last edited by
                                #17

                                @mbnoimi

                                I didn't say that!
                                I said I get Failed to load translation from static library

                                Indeed you did, it's my mistake, sorry.

                                which points to myTranslator->load(":/languages/arabic") failure!

                                Could you verify that this file is available? For example what does QFile::exists(":/languages/arabic") return, true or false? If the file exists then the problem is with the actual loading, if the file is not found, then I guess there's a problem with the resource initialization.

                                Kind regards.

                                Read and abide by the Qt Code of Conduct

                                M 1 Reply Last reply 10 Jan 2016, 11:57
                                0
                                • K kshegunov
                                  10 Jan 2016, 11:49

                                  @mbnoimi

                                  I didn't say that!
                                  I said I get Failed to load translation from static library

                                  Indeed you did, it's my mistake, sorry.

                                  which points to myTranslator->load(":/languages/arabic") failure!

                                  Could you verify that this file is available? For example what does QFile::exists(":/languages/arabic") return, true or false? If the file exists then the problem is with the actual loading, if the file is not found, then I guess there's a problem with the resource initialization.

                                  Kind regards.

                                  M Offline
                                  M Offline
                                  mbnoimi
                                  wrote on 10 Jan 2016, 11:57 last edited by
                                  #18

                                  @kshegunov said:

                                  Could you verify that this file is available? For example what does QFile::exists(":/languages/arabic") return, true or false?

                                  I get true

                                  If the file exists then the problem is with the actual loading, if the file is not found, then I guess there's a problem with the resource initialization.

                                  After reviewing the project I discovered there are two "resources.qrc" the first one in the static library and the other in tester app. so I supposed this maybe makes Qt confused so I renamed one of them to a different name but unfortunately I still get same result.

                                  K 1 Reply Last reply 10 Jan 2016, 12:19
                                  0
                                  • M mrjj
                                    9 Jan 2016, 11:38

                                    Hi
                                    Maybe try

                                    QDirIterator it(":", QDirIterator::Subdirectories);
                                        while (it.hasNext()) {
                                            qDebug() << it.next();
                                        }
                                    

                                    to have a look how the files are named in the running exe to to verify
                                    that they are indeed under ":/i18n" and paths are as you expect.

                                    M Offline
                                    M Offline
                                    mbnoimi
                                    wrote on 10 Jan 2016, 12:17 last edited by mbnoimi 1 Oct 2016, 12:18
                                    #19

                                    @mrjj said:

                                    QDirIterator it(":", QDirIterator::Subdirectories);
                                        while (it.hasNext()) {
                                            qDebug() << it.next();
                                        }
                                    

                                    to have a look how the files are named in the running exe to to verify
                                    that they are indeed under ":/i18n" and paths are as you expect.

                                    I got this output:

                                    Failed to load translation from static library
                                    ":/qt-project.org"
                                    ":/qt-project.org/qmime"
                                    ":/qt-project.org/qmime/freedesktop.org.xml"
                                    ":/qt-project.org/styles"
                                    ":/qt-project.org/styles/commonstyle"
                                    ":/qt-project.org/styles/commonstyle/images"
                                    ":/qt-project.org/styles/commonstyle/images/networkdrive-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/networkdrive-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/dvd-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/cdr-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/up-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/up-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/dvd-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/cdr-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/left-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/stop-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/file-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/down-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/stop-24.png"
                                    ":/qt-project.org/styles/commonstyle/images/left-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/down-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/file-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/dirlink-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/diropen-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/diropen-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/cleartext-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/dirlink-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/networkdrive-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-open-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-apply-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/fonttruetype-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/newdirectory-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/filecontents-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/floppy-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-delete-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/harddrive-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-clear-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-close-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/dirclosed-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/trash-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-apply-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-yes-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/fontbitmap-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/newdirectory-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/dirclosed-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/newdirectory-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/dirclosed-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/up-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-pause-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-pause-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/cdr-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/dvd-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-volume-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/harddrive-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/harddrive-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-hover-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/viewdetailed-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/fusion_groupbox.png"
                                    ":/qt-project.org/styles/commonstyle/images/right-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/fileinfo-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/filelink-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/filelink-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/fileinfo-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/dirlink-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-seek-forward-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/diropen-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-help-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/viewdetailed-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-seek-backward-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-ok-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-no-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/refresh-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/refresh-24.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-save-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/viewlist-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-yes-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/computer-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/computer-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/parentdir-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/parentdir-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-play-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/desktop-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-stop-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/desktop-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-play-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/down-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-stop-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-delete-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-skip-backward-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"
                                    ":/qt-project.org/styles/commonstyle/images/viewlist-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/viewlist-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/file-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/floppy-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/left-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/floppy-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-no-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-ok-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/media-skip-forward-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/filelink-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-open-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/fileinfo-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-help-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-save-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-down-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/parentdir-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/filecontents-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/trash-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/filecontents-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/trash-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/right-16.png"
                                    ":/qt-project.org/styles/commonstyle/images/right-32.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-clear-128.png"
                                    ":/qt-project.org/styles/commonstyle/images/standardbutton-close-128.png"
                                    ":/qt-project.org/styles/macstyle"
                                    ":/qt-project.org/styles/macstyle/images"
                                    ":/qt-project.org/styles/macstyle/images/toolbar-ext.png"
                                    ":/qt-project.org/styles/macstyle/images/dockdock-down-16.png"
                                    ":/qt-project.org/styles/macstyle/images/closedock-16.png"
                                    ":/qt-project.org/styles/macstyle/images/dockdock-16.png"
                                    ":/qt-project.org/styles/macstyle/images/closedock-down-16.png"
                                    ":/qt-project.org/styles/macstyle/images/toolbar-ext@2x.png"
                                    ":/qt-project.org/qmessagebox"
                                    ":/qt-project.org/qmessagebox/images"
                                    ":/qt-project.org/qmessagebox/images/qtlogo-64.png"
                                    ":/i18n"
                                    ":/i18n/tester_ar.qm"
                                    ":/i18n/tester_de.qm"
                                    ":/i18n/tester_fr.qm"
                                    ":/i18n/tester_en.qm"
                                    ":/i18n/tester_ru.qm"
                                    ":/i18n/tester_it.qm"
                                    ":/languages"
                                    ":/languages/i18n"
                                    ":/languages/i18n/WidgetKeyboard_fr.qm"
                                    ":/languages/i18n/WidgetKeyboard_ar.qm"
                                    ":/languages/i18n/WidgetKeyboard_de.qm"
                                    ":/languages/i18n/WidgetKeyboard_en.qm"
                                    ":/languages/i18n/WidgetKeyboard_it.qm"
                                    ":/languages/i18n/WidgetKeyboard_ru.qm"
                                    ":/images"
                                    ":/images/cut"
                                    ":/images/copy"
                                    ":/images/logo"
                                    ":/images/paste"
                                    ":/images/normalEcho"
                                    ":/images/passwdEcho"
                                    ":/sounds"
                                    ":/sounds/click.wav"
                                    QSoundEffect(pulseaudio): Error decoding source
                                    
                                    1 Reply Last reply
                                    0
                                    • M mbnoimi
                                      10 Jan 2016, 11:57

                                      @kshegunov said:

                                      Could you verify that this file is available? For example what does QFile::exists(":/languages/arabic") return, true or false?

                                      I get true

                                      If the file exists then the problem is with the actual loading, if the file is not found, then I guess there's a problem with the resource initialization.

                                      After reviewing the project I discovered there are two "resources.qrc" the first one in the static library and the other in tester app. so I supposed this maybe makes Qt confused so I renamed one of them to a different name but unfortunately I still get same result.

                                      K Offline
                                      K Offline
                                      kshegunov
                                      Moderators
                                      wrote on 10 Jan 2016, 12:19 last edited by
                                      #20

                                      @mbnoimi
                                      What about loading like this:

                                          translator->load("arabic", ":/languages");
                                      

                                      And as a second suggestion: I think you should create another QTranslator object for the second translation file.

                                      Kind regards.

                                      Read and abide by the Qt Code of Conduct

                                      M 1 Reply Last reply 10 Jan 2016, 12:24
                                      0
                                      • K kshegunov
                                        10 Jan 2016, 12:19

                                        @mbnoimi
                                        What about loading like this:

                                            translator->load("arabic", ":/languages");
                                        

                                        And as a second suggestion: I think you should create another QTranslator object for the second translation file.

                                        Kind regards.

                                        M Offline
                                        M Offline
                                        mbnoimi
                                        wrote on 10 Jan 2016, 12:24 last edited by mbnoimi 1 Oct 2016, 12:24
                                        #21

                                        @kshegunov said:

                                        And as a second suggestion: I think you should create another QTranslator object for the second translation file.

                                        Thanks. This fixed Tester app. problem but it didn't fix the main problem (loading translation from static library) I still get this error message:

                                        Failed to load translation from static library

                                        K 1 Reply Last reply 10 Jan 2016, 12:27
                                        0
                                        • M mbnoimi
                                          10 Jan 2016, 12:24

                                          @kshegunov said:

                                          And as a second suggestion: I think you should create another QTranslator object for the second translation file.

                                          Thanks. This fixed Tester app. problem but it didn't fix the main problem (loading translation from static library) I still get this error message:

                                          Failed to load translation from static library

                                          K Offline
                                          K Offline
                                          kshegunov
                                          Moderators
                                          wrote on 10 Jan 2016, 12:27 last edited by
                                          #22

                                          @mbnoimi
                                          And have you tried the loading like this translator->load("arabic", ":/languages");, since you didn't comment on that?

                                          Read and abide by the Qt Code of Conduct

                                          M 2 Replies Last reply 10 Jan 2016, 12:29
                                          0

                                          12/32

                                          10 Jan 2016, 10:46

                                          • Login

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