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. Lrelease and type="unfinished"

Lrelease and type="unfinished"

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 2 Posters 2.8k 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
    Sandra_Carney
    wrote on last edited by
    #1

    Hello,
    Version of Qt: 5.12.0
    OS: CentOS 7.6

    The manifestation of the problem is we:

    • Select a language other than English.

    • Then logout and log back in.

    • Then attempt to select English again.

    • The text does not go back to English.

    What I found is that virtually every entry in the English .ts file has something like:

        <message>
            <source>Some text</source>
            <translation type="unfinished"></translation>
        </message>
    
    

    When we run these text files through lupdate followed by lrelease, the resulting .qm file is about 16 Kb(tiny). When I add '-markuntranslated " "' as an option to lrelease, the resulting .qm file is around 10000 Kb and I can go back and forth between English and other languages without any trouble. Now the lrelease document says

    Note: The lrelease tool only incorporates translations that are marked as "finished". Otherwise the original text is used instead.
    
    Pass the -help option to lrelease to view supported options.
    
    Missing Translations
    Both lupdate and lrelease may be used with TS translation source files which are incomplete. Missing translations will be replaced with the native language phrases at runtime.
    

    That is not what I am seeing. Is this because all of them are of type="unfinished"?

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

      An internal Qt Linguisitcs expert worked with me on this. He said the reason you can't get English to reload again is because of the empty <translation></translation> entries. He contends those need to be populated with what ever is in the <source>...</source> and then the system can 'translate' back to English. Truth is that is the first thing I tried and it worked. What is what I am going to with.

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Sandra_Carney said in Lrelease and type="unfinished":

        Is this because all of them are of type="unfinished"?

        Correct - simply mark them as finished in your linguist and they will be used.

        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
        2
        • S Offline
          S Offline
          Sandra_Carney
          wrote on last edited by
          #3

          One more question. Is this the reason why I can't go back to English from another language?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sandra_Carney
            wrote on last edited by
            #4

            So removing the 'type="unfinished"' is not enough. I have to change it to 'type="finished"'?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Sandra_Carney
              wrote on last edited by
              #5

              I went ahead and changed the type to "finished" but left the text blank. The logs show that an attempt was made to english:

              Feb  5 11:54:11 localhost App: Language changed to en_US
              Feb  5 11:54:11 localhost App: IBus input localization disabled
              

              But the English didn't reload.

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @Sandra_Carney said in Lrelease and type="unfinished":

                But the English didn't reload.

                Without code? You have to unload the other translator.

                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
                • S Offline
                  S Offline
                  Sandra_Carney
                  wrote on last edited by
                  #7

                  Here is the code:

                      QCoreApplication::removeTranslator(&_translator);
                      qstrCurrLang = LMSettings::getCurrentLanguage();
                      QString qstrLangPath = QString("%1/LoginManager_%2.qm").arg(DEFAULT_LOCALE_PATH).arg(qstrCurrLang);
                   
                      _translator.load(qstrLangPath);
                      QCoreApplication::installTranslator(&_translator);
                   
                      QLocale::setDefault(QLocale(qstrCurrLang));
                      QString qstrLang = QString("%1.%2").arg(qstrCurrLang).arg(LMSettings::getCurrentCharMap());
                      qputenv("LANG", qstrLang.toLatin1().data());
                      qputenv("LC_ALL", qstrLang.toLatin1().data());
                      syslog(LOG_INFO,qPrintable(QString("Language changed to %1").arg(qstrCurrLang)));
                  

                  More information that might shed light on this.

                  a) I execute the application(App) and Select German.
                  c) App switches to German.
                  d) Within the same session, I can switch back to English.
                  e) If I leave it at German and then reboot ...
                  f) I launch App and it comes up in German which is to be expected.
                  g) If I try to switch to English, it stays German.
                  h) Here is the interesting part. Now I switch to another language like French or Italian.
                  i) App redisplays in that language.
                  j) Now I select English. App displays in German.

                  Any insights would be welcome.

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

                    An internal Qt Linguisitcs expert worked with me on this. He said the reason you can't get English to reload again is because of the empty <translation></translation> entries. He contends those need to be populated with what ever is in the <source>...</source> and then the system can 'translate' back to English. Truth is that is the first thing I tried and it worked. What is what I am going to with.

                    1 Reply Last reply
                    0
                    • Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      Then please mark the topic as solved, thx.

                      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

                      • Login

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