i18n files *.ts are always empty
-
I had create a very simple demo for i18n implement, for the QT default cmake, the ts files are empty, so I refer to the official example "I18N Example" to refresh the cmake, the resource i18n files are still empty,
it like below:
the QT version information as below
the cmake as below:
cmake_minimum_required(VERSION 3.16) project(frontier02 LANGUAGES CXX) set(CMAKE_AUTOMOC ON) if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/frontier02") find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets LinguistTools) qt_standard_project_setup( I18N_TRANSLATED_LANGUAGES en_US zh_CN fr_FR ) qt_add_executable(frontier02 main.cpp frontierMainWindow.cpp frontierMainWindow.h ) set_target_properties(frontier02 PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) target_link_libraries(frontier02 PUBLIC Qt::Core Qt::Gui Qt::Widgets ) qt_add_translations(frontier02 TS_FILE_DIR translations ) install(TARGETS frontier02 RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" )
the relative code like below
#include "frontierMainWindow.h" frontierMainWindow::frontierMainWindow(QWidget *parent) : QMainWindow(parent) { this->setWindowTitle(tr("hello")); this->resize(QSize(400, 600)); tempButton = new QPushButton(this); tempButton->setText(tr("family")); tempButton->move(100, 100); } frontierMainWindow::~frontierMainWindow() {}
I find some information at the compile output
anybody can give me some advice?? thank you in advance !! I wish the QT Creator can provide a easy and convenient way to implement i18n!!
-
Hi,
Did you run
make update_translations
?