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. Qt Linguist can't find some words
Forum Updated to NodeBB v4.3 + New Features

Qt Linguist can't find some words

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 598 Views
  • 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.
  • D Offline
    D Offline
    davidesalvetti
    wrote on last edited by
    #1

    Hi guys,

    I'm having a problem using Qt linguist. I don't know why the name of the QToolButton I create in the .cpp are not found when i generate the .ts file. This is the code I'm talking about:

    addCanali = new QToolButton(ui->toolBar);
        addCanali->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        addCanali->setIcon(QIcon(":/rec/img/wave_amplify_frequency.png"));
        addCanali->setStyleSheet("background-color:black; color:white");
        addCanali->setText("Channels");                //this is the word I have to translate
        addCanali->setFocusPolicy(Qt::NoFocus);
        ui->toolBar->addWidget(addCanali);
    connect(addCanali, SIGNAL(clicked()), this, SLOT(on_actionCanale_triggered()));
    

    To create the .ts file I followed this tutorial. Basically the steps are:

    1- Open MinGw command line
    2 - Go to your project folder
    3- lupdate -pro yourappname.pro -ts Italian.ts

    To add some more information, the File .cpp where these words are is under a .pri file, I don't know if maybe this can cause some issues while creating the .ts file.

    Am I missing something?

    Thanks in advance.

    jsulmJ 1 Reply Last reply
    0
    • D davidesalvetti

      Hi guys,

      I'm having a problem using Qt linguist. I don't know why the name of the QToolButton I create in the .cpp are not found when i generate the .ts file. This is the code I'm talking about:

      addCanali = new QToolButton(ui->toolBar);
          addCanali->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
          addCanali->setIcon(QIcon(":/rec/img/wave_amplify_frequency.png"));
          addCanali->setStyleSheet("background-color:black; color:white");
          addCanali->setText("Channels");                //this is the word I have to translate
          addCanali->setFocusPolicy(Qt::NoFocus);
          ui->toolBar->addWidget(addCanali);
      connect(addCanali, SIGNAL(clicked()), this, SLOT(on_actionCanale_triggered()));
      

      To create the .ts file I followed this tutorial. Basically the steps are:

      1- Open MinGw command line
      2 - Go to your project folder
      3- lupdate -pro yourappname.pro -ts Italian.ts

      To add some more information, the File .cpp where these words are is under a .pri file, I don't know if maybe this can cause some issues while creating the .ts file.

      Am I missing something?

      Thanks in advance.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @davidesalvetti said in Qt Linguist can't find some words:

      addCanali->setText("Channels");

      shouldn't it be

      addCanali->setText(tr("Channels"));
      

      ?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      4
      • jsulmJ jsulm

        @davidesalvetti said in Qt Linguist can't find some words:

        addCanali->setText("Channels");

        shouldn't it be

        addCanali->setText(tr("Channels"));
        

        ?

        D Offline
        D Offline
        davidesalvetti
        wrote on last edited by
        #3

        @jsulm yes, my mistake. I'm sorry. I just read this from Docs. Thanks a lot!

        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