Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. translate

    Log in to post
    • All categories
    • C

      Solved Cannot Translate QT Quick Properties Dynamically
      QML and Qt Quick • qml qtquick translate international qtquick 1.0 • • closx

      13
      0
      Votes
      13
      Posts
      1187
      Views

      C

      @KroMignon Hey! I forgot to answer to you! Did not meant to be rude and sorry for that :(
      Conclusion: I gave some tries with your suggest and lots of other stuff on internet, but failed :D
      So I have created a "Restart the system to apply all the language changes" screen and a "restart/cancel" choice on a language change state. I guess it will be okay even if it wont be "real-time" :P
      Good Work!

    • C

      Solved Cannot Translate ListElement "name" Variables
      QML and Qt Quick • qml qtquick qtquick 1.0 translate translation • • closx

      3
      0
      Votes
      3
      Posts
      429
      Views

      C

      @KroMignon LOVE YOU!
      Thank you very much, worked w/out problems, and made me understand my mistake.
      note: Needed to update .ts file and release .qm file after changing code.

    • S

      Unsolved Lupdate and macros
      General and Desktop • lupdate macros translate • • sailor.steve

      3
      0
      Votes
      3
      Posts
      897
      Views

      Pablo J. Rogina

      @sailor.steve said in Lupdate and macros:

      I wrapped the text in macros that need to be translated

      In addition to @sierdzio response, please keep in mind that Qt translation tools use the "original" text as the key for looking the proper translation in the available loaded Qt translator object, and if such string is not found, that same string is displayed instead.

      This is a little bit different from some other translation tools that use "constants" (i.e. macro?) as the key and then you provide a file with constant -> translation pairs.

    • O

      Solved QT_TRANSLATE_NOOP inside static const QMap?
      General and Desktop • translate international i18n translator • • Opa114

      11
      0
      Votes
      11
      Posts
      4855
      Views

      O

      @mrjj okay - thanks for help!

    • R

      Unsolved How to translate text dynamically...?
      Mobile and Embedded • translate qt 4.7.4 qt 5.5.0 • • Rohith

      9
      0
      Votes
      9
      Posts
      2940
      Views

      ?

      @Rohith I don't know. Use Google Search to find it out!

    • SeeLook

      Solved Using Qt translated texts causes adding them to app ts
      General and Desktop • translations lupdate translate • • SeeLook

      3
      0
      Votes
      3
      Posts
      1286
      Views

      SeeLook

      Another solution that not require hacking Qt is to alias QApplication::translate method:

      inline QString myTr(const char* context, const char* key, const char* disambiguation = 0, int n = -1) { return QApplication::translate(context, key, disambiguation, n); }

      and then get translated text with:

      myTr("QShortcut", "Help");

      Such texts are invisible for lupdate.

    • A

      need help to translate python script to Qt quick qml code
      QML and Qt Quick • qt quick python qml translate • • antemort

      2
      0
      Votes
      2
      Posts
      965
      Views

      p3c0

      Hi @antemort,
      It can't be done purely in QML. You will need to use sockets on C++ side. Qt has C++ API's for sockets. QTcpServer creates a server and QTcpSocket for client. After that you will need to expose them to QML.
      Edit: Some one has tried to do that already. See https://github.com/jemc/qml-sockets

    • G

      Dynamic translation of strings in widgets
      General and Desktop • qtcreator translate dynamic • • GregWilsonLindberg

      10
      0
      Votes
      10
      Posts
      6210
      Views

      A

      Below is an answer.

      void MyWidget::changeEvent(QEvent *event)
      {
      if (e->type() == QEvent::LanguageChange) {
      titleLabel->setText(tr("Document Title"));
      ...
      okPushButton->setText(tr("&OK"));
      } else
      QWidget::changeEvent(event);
      }

      code within if (e->type() == QEvent::LanguageChange) { ... )
      should contain ALL the code which has to be called when language changed.
      Basically every line of the code with tr() has to be called there.

      In there you can put call to retranslateUi,
      but retranslateUi is just a function where QtDesigner put strings created in there.
      this might be or might not be sufficient for your widget.
      Finally there are people who do not use designer.
      That is why you could not find retranslateUi mentioned anywhere.
      Keyword is tr().

      For example you may fill tree widget outside of designer.
      If you used text which has to be internationalized there, you need to make sure the same code is executed as a reaction on language changed.

      Common logic suggests to put all code which requires initialization in a single function or slot.
      Such function or slot should be called when QEvent::LanguageChange arrives.
      Call this function myRetranslateUi if you want.

      You do not have to subclass every widget (as suggested by example) though.
      Alternative is to install event filter.

    • J

      How to extract text, translate, and display
      Mobile and Embedded • android http translate qnetwork • • jjoejimmy

      1
      0
      Votes
      1
      Posts
      581
      Views

      No one has replied