Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Translation not working for long strings



  • 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.")


  • Qt Champions 2017

    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 ?



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


  • Qt Champions 2017

    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.



  • 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.


  • Qt Champions 2017

    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"



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


  • Moderators

    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 ;-)


Log in to reply