Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Providing a no-op translation for QTranslator

    General and Desktop
    2
    2
    169
    Loading More Posts
    • 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
      apjanke last edited by

      What is the right way to provide a "no-op" QTranslator translation where all the UI strings are left as their original native language phrases?

      The scenario is this: QTermWidget is written in English and uses QTranslator and tr() for localization. It has *.qm translation files for fr, de, and other languages, but not one for English.

      The issue is that on a computer where English is the primary language, but it also has additional preferred languages defined where QTermWidget has a translation available (such as French), QTranslator seems to be picking up that translation and using it, instead of leaving the phrases untranslated, so the UI phrases are in the wrong language for the user's config.

      Details: https://github.com/lxqt/qtermwidget/issues/263

      It seems we need to provide a no-op English en translation to prevent this from happening.

      What's the Right Way to do this? Can we provide an empty .ts file for en? Just copy the input qtermwidget.ts to qtermwidget_en.ts and leave all the <translation>s as "unfinished"? Manually fill them all out with the same strings as the original?

      Related:
      https://forum.qt.io/topic/71000/how-to-clear-qtranslator/5
      https://forum.qt.io/topic/62723/qt-widgets-show-german-default-labels-on-uk-windows-system (maybe)

      1 Reply Last reply Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion last edited by

        I'm using an empty .ts file for this. Just copy another ts file, remove all inside <context>...</context> and change the language.

        Qt has to stay free or it will die.

        1 Reply Last reply Reply Quote 3
        • First post
          Last post