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. i18n files *.ts are always empty
Forum Updated to NodeBB v4.3 + New Features

i18n files *.ts are always empty

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

    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:
    2f6780e0-6e41-4e4d-9edc-85cb0c456fa9-image.png 711b1b74-d74c-43a8-ad48-7f06d9186fec-image.png

    the QT version information as below

    24d406a2-7d5c-4c4c-b1b7-e705629ab7c3-image.png

    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

    5b86121a-9e73-4432-a858-f30589543616-image.png

    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!!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you run make update_translations ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

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