JenyaKh
JenyaKh

Reputation: 2498

QCommandLineParser --help and --help-all options are not translated

I have got this result when using https://doc.qt.io/qt-5/qcommandlineparser.html#addHelpOption:

Использование: ./build/Debug/client/myapp [параметры]

Параметры:
  -h, --help                 Displays help on commandline options.
  --help-all                 Displays help including Qt specific options.
  -v, --version              Отобразить информацию о версии.

As one can see, the help entries are not traslated.

I tried to find a more full qt_ru.qm file or a qt_ru.ts file, but failed. How can be this fixed? Any ideas, please?

UPDATE (THE SOLUTION)

For those who are interested. I was inspired by the answer of user HiFile.app - best file manager below. I have not found qt_ru.ts. Instead, in my OWN myapp_ru.ts file I added the text below, and suddenly it turned out to be enough to translate the --help and --help-all entries:

<context>
    <name>QCommandLineParser</name>
    <message>
        <source>Displays help on commandline options.</source>
        <translation>Вывод справки по параметрам командной строки.</translation>
    </message>
    <message>
        <source>Displays help including Qt specific options.</source>
        <translation>Вывод справки с особыми параметрами Qt.</translation>
    </message>
</context>

Upvotes: 1

Views: 243

Answers (1)

The translation files (*.ts) are in Qt sources, so you need to install Qt framework with source files. The text you are referring to can be found in Src/qttranslations/translations/qtbase_ru.ts. It depends on the Qt version which you are using, but AFAIK it seems to be translated in the latest Qt 6.4. If it is not translated in your Qt version, you can update the *.ts file yourself and convert it to *.qm using Qt Linguist application.

enter image description here

Upvotes: 2

Related Questions