Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Translation not working for long strings

Translation not working for long strings

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 3 Posters 1.2k 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.
  • S Offline
    S Offline
    Sanjeev Gudisagar
    wrote on last edited by
    #1

    I am trying to translate this string , but translation is not working

    text: qsTr("Sunset is the time of day when our sky meets the outer space solar winds.\n
    There are blue, pink, and purple swirls, spinning and twisting, like clouds of balloons caught in a blender.\n\n
    The sun moves slowly to hide behind the line of horizon, while the moon races to take its place in prominence atop the night sky.")

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Can you check whether your load of qm file successful ? Assuming that you have other strings in qml. If the load is successful, you should see other texts translated. Can you check ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Sanjeev Gudisagar
        wrote on last edited by
        #3

        load is successful, the other strings are translating but i have issue with this string only

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Ok. When you do the translation some times translated data is not saved. Can you open the ts file using some text editor & see if the translated text exist for this string ? It very trivial but still let me ask you this. If you see translated text as unfinished in the ts files, just save the file in linguist tool & check the translation again.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          1
          • S Offline
            S Offline
            Sanjeev Gudisagar
            wrote on last edited by
            #5

            Yes i have cross checked it.. Linguist says texts as finished and i have saved the translation file, still the the text is not getting translated.

            1 Reply Last reply
            0
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by
              #6

              When i see your text you have new line character("\n") and also new line. Why do you want to have both ? Can you try putting your big text into one line & separate each sentence by '\n'

              e.g
              "I'm doing ok. \n It is time for dinner \n Good bye \n"

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              1 Reply Last reply
              6
              • S Offline
                S Offline
                Sanjeev Gudisagar
                wrote on last edited by Sanjeev Gudisagar
                #7

                I tried writing text in single line, its working fine now... thank you @dheerendra

                1 Reply Last reply
                0
                • J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  I believe this comes from the limitation of the JS-engine. That one doesn't handle multi line stuff very well.

                  I think, this is untested but, this should work as well

                  text: qsTr("Sunset is the time of day when our sky meets the outer space solar winds.\n\
                  There are blue, pink, and purple swirls, spinning and twisting, like clouds of balloons caught in a blender.\n\n\
                  The sun moves slowly to hide behind the line of horizon, while the moon races to take its place in prominence atop the night sky.")
                  

                  @Sanjeev-Gudisagar don't forget to set your topic to solved, now that's working for you ;-)


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  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