Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Using QTranslator to get original strings as well as translated strings



  • I'm using the following code to get a Russian translation of all my strings:
    @
    m_translator = new QTranslator(this);
    qApp->installTranslator(m_translator);
    m_translator->load(":/Traductions/Autostream2_rs.qm");
    @

    I've set up the .ts and .qm files properly, and I see all the strings in Russian. That part works fine. Occasionally, however, it'll be necessary to show the original English as well on the same form. Is there any way to go back and get the original text without deleting m_translator?



  • Hi,

    IMHO you can:

    • use QApplication::removeTranslator()
    • modify you code in order to use tr() in a conditioned way

Log in to reply