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. Providing a no-op translation for QTranslator
Forum Updated to NodeBB v4.3 + New Features

Providing a no-op translation for QTranslator

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 331 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.
  • A Offline
    A Offline
    apjanke
    wrote on last edited by
    #1

    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
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      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
      3

      • Login

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