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.7k 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.
  • P Offline
    P Offline
    Pradeep Kumar
    wrote on 5 Dec 2015, 05:11 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

    R 1 Reply Last reply 5 Dec 2015, 05:21
    0
    • P Pradeep Kumar
      5 Dec 2015, 05:11

      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

      R Offline
      R Offline
      Ratzz
      wrote on 5 Dec 2015, 05:21 last edited by Ratzz 12 May 2015, 05:26
      #2

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

      --Alles ist gut.

      1 Reply Last reply
      1
      • P Offline
        P Offline
        Pradeep Kumar
        wrote on 19 Aug 2016, 11:49 last edited by
        #3

        @Ratzz

        I have used QT_TR_NOOP which worked.

        Thanks.

        Pradeep Kumar
        Qt,QML Developer

        1 Reply Last reply
        3
        • P Offline
          P Offline
          Pradeep Kumar
          wrote on 29 Sept 2016, 08:34 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
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 29 Sept 2016, 09:08 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
            • P Offline
              P Offline
              Pradeep Kumar
              wrote on 29 Sept 2016, 09:10 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