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. How to make values stored in QString variables translate to other languages.
Forum Updated to NodeBB v4.3 + New Features

How to make values stored in QString variables translate to other languages.

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 2.8k Views 2 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.
  • Pradeep KumarP Offline
    Pradeep KumarP Offline
    Pradeep Kumar
    wrote on last edited by
    #1

    hi can anyone say, how to make values stored in QString variables translate to otehr languages ,
    i have tried with Qlabel and Qpushbutton using tr(), to translate to other languages.
    while reading documentation i came across QT_TR_NOOP(), QT_TRANSLATE_NOOP(). when i made use of QT_TR_NOOP the variables was generated in ts file, i was able to view in Qt Linguist. but the values are not translating so shanyone tell me how to make QString

    Pradeep Kumar
    Qt,QML Developer

    RatzzR 1 Reply Last reply
    0
    • Pradeep KumarP Pradeep Kumar

      hi can anyone say, how to make values stored in QString variables translate to otehr languages ,
      i have tried with Qlabel and Qpushbutton using tr(), to translate to other languages.
      while reading documentation i came across QT_TR_NOOP(), QT_TRANSLATE_NOOP(). when i made use of QT_TR_NOOP the variables was generated in ts file, i was able to view in Qt Linguist. but the values are not translating so shanyone tell me how to make QString

      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by Ratzz
      #2

      @Pradeep-Kumar
      Hi ,
      May be QTranslator ,source translation and internationalization help you.

      --Alles ist gut.

      1 Reply Last reply
      1
      • Pradeep KumarP Offline
        Pradeep KumarP Offline
        Pradeep Kumar
        wrote on last edited by
        #3

        @Ratzz

        I have used QT_TR_NOOP which worked.

        Thanks.

        Pradeep Kumar
        Qt,QML Developer

        1 Reply Last reply
        3
        • Pradeep KumarP Offline
          Pradeep KumarP Offline
          Pradeep Kumar
          wrote on last edited by Pradeep Kumar
          #4

          Posting the code , which will be helpfull.
          using QT_TR_NOOP the QString value will be shown in Qt Linguist for translating to respective language, but for actual value to be translated and to be reflected in widgets we need to use tr for QString value.

          Here is a sample code.

          m_label = new QLabel;

          QString appendData;
          appendData = QT_TR_NOOP(tr("First Label"));
          m_label->setText(appendData);

          We can also use QT_TR_NOOP and QT_TR_NOOP_UTF8.

          Pradeep Kumar
          Qt,QML Developer

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

            Hi,

            See here for an example of how to use these macros.

            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
            1
            • Pradeep KumarP Offline
              Pradeep KumarP Offline
              Pradeep Kumar
              wrote on last edited by
              #6

              @SGaist

              Thanks for the link and info.

              Pradeep Kumar
              Qt,QML Developer

              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