Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Lrelease and type="unfinished"



  • 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"?



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


  • Lifetime Qt Champion

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



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



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



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


  • Lifetime Qt Champion

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

    But the English didn't reload.

    Without code? You have to unload the other translator.



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



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


  • Lifetime Qt Champion

    Then please mark the topic as solved, thx.


Log in to reply