qtubuntu-22.04qtranslator

How to add translation file to Qt in Ubuntu


I am not able to create a translation file in a Qt Creator Widgets project.

In main.cpp, mainwindow.cpp and mainwindow.h, I have:

#include <QTranslator>

In the pro file I have

TRANSLATIONS = lang_en.ts

I should note that:

When I execute lupdate from the GUI it prints:

Starting external tool "/usr/lib/qt6/bin/lupdate /home/moritz/C++/Georechner.pro"

When I execute:

lupdate -verbose ~/C++/GeoRechner/Georechner_aktuell/Georechner.pro

in the terminal, it prints:

WARNING: Could not find qmake spec 'default'.

And no .tr file is to be found. I suppose I am missing some Qt language installation or update or something of the kind?

I'm using Ubuntu 22.04.

Related:


Solution

  • Janjua's answer from here did it: lupdate doesn't create .ts translations file

    On my system the lupdate file to execute (because there are several), is

    /home/moritz/Qt/6.6.0/gcc_64/bin/lupdate
    so in total :

    /home/moritz/Qt/6.6.0/gcc_64/bin/lupdate ~/path/to/project/projectname.pro