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 string - new line character

Translation string - new line character

Scheduled Pinned Locked Moved Solved QML and Qt Quick
20 Posts 5 Posters 5.6k 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.
  • dheerendraD dheerendra

    where are you strings ? Are they in some file ? You can directly do there. How are you doing the translations ? Using linguist ?

    S Offline
    S Offline
    Sandhiya
    wrote on last edited by
    #11

    @dheerendra strings are nothing but the <translation> ryt? They are not there in some other file. Not using linguist for editing the .ts file

    Pablo J. RoginaP 1 Reply Last reply
    0
    • S Sandhiya

      @dheerendra strings are nothing but the <translation> ryt? They are not there in some other file. Not using linguist for editing the .ts file

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #12

      @Sandhiya said in Translation string - new line character:

      strings are nothing but the <translation> ryt? They are not there in some other file

      Could you please show some source code snippet about how you're using the strings in your Qt application?

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      S 1 Reply Last reply
      2
      • Pablo J. RoginaP Pablo J. Rogina

        @Sandhiya said in Translation string - new line character:

        strings are nothing but the <translation> ryt? They are not there in some other file

        Could you please show some source code snippet about how you're using the strings in your Qt application?

        S Offline
        S Offline
        Sandhiya
        wrote on last edited by
        #13

        @Pablo-J.-Rogina
        QML file:
        Label{
        text:qsTrId("text_id")
        }

        .ts file:
        <message id = "tex_id">
        <location filename="fileLocation"/>
        <translation>Please file \n the text field</translation>
        </message>

        This is the snippet of how I am using the strings

        Pablo J. RoginaP 1 Reply Last reply
        0
        • S Sandhiya

          @Pablo-J.-Rogina
          QML file:
          Label{
          text:qsTrId("text_id")
          }

          .ts file:
          <message id = "tex_id">
          <location filename="fileLocation"/>
          <translation>Please file \n the text field</translation>
          </message>

          This is the snippet of how I am using the strings

          Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #14

          @Sandhiya are you sure you created .qm files with

          lupdate -idbased your_project.pro
          

          This snippet is working fine

          Window {
              visible: true
              width: 640
              height: 480
              title: qsTrId("title_id")
          
              Label {
                  text: qsTrId("text_id")
              }
          }
          

          when edited with Linguist, I just pressed Enter when I wanted the line break
          alt text
          showing in app great:
          alt text

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          S D 2 Replies Last reply
          3
          • Pablo J. RoginaP Pablo J. Rogina

            @Sandhiya are you sure you created .qm files with

            lupdate -idbased your_project.pro
            

            This snippet is working fine

            Window {
                visible: true
                width: 640
                height: 480
                title: qsTrId("title_id")
            
                Label {
                    text: qsTrId("text_id")
                }
            }
            

            when edited with Linguist, I just pressed Enter when I wanted the line break
            alt text
            showing in app great:
            alt text

            S Offline
            S Offline
            Sandhiya
            wrote on last edited by
            #15

            @Pablo-J.-Rogina Yeah ..it's working fine now. I actually missed a trick there. Thanks a lot for your help.

            Pablo J. RoginaP 1 Reply Last reply
            0
            • dheerendraD dheerendra

              where are you strings ? Are they in some file ? You can directly do there. How are you doing the translations ? Using linguist ?

              S Offline
              S Offline
              Sandhiya
              wrote on last edited by
              #16

              @dheerendra Thanks for your help..

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

                This is what we were asking you. It is as simple as hitting the enter button in source text when we require new line. Now issue is resolved move the case to solved state.

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

                1 Reply Last reply
                0
                • S Sandhiya

                  @Pablo-J.-Rogina Yeah ..it's working fine now. I actually missed a trick there. Thanks a lot for your help.

                  Pablo J. RoginaP Offline
                  Pablo J. RoginaP Offline
                  Pablo J. Rogina
                  wrote on last edited by
                  #18

                  @Sandhiya said in Translation string - new line character:

                  I actually missed a trick there.

                  which was...? could you please describe it? As mentioned before, please don't forget to mark your post as solved.

                  Upvote the answer(s) that helped you solve the issue
                  Use "Topic Tools" button to mark your post as Solved
                  Add screenshots via postimage.org
                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  0
                  • Pablo J. RoginaP Pablo J. Rogina

                    @Sandhiya are you sure you created .qm files with

                    lupdate -idbased your_project.pro
                    

                    This snippet is working fine

                    Window {
                        visible: true
                        width: 640
                        height: 480
                        title: qsTrId("title_id")
                    
                        Label {
                            text: qsTrId("text_id")
                        }
                    }
                    

                    when edited with Linguist, I just pressed Enter when I wanted the line break
                    alt text
                    showing in app great:
                    alt text

                    D Offline
                    D Offline
                    Dhiru
                    wrote on last edited by
                    #19

                    @Pablo-J.-Rogina Also i have same type issue which I fixed on one way to after next line character put on next line like below.
                    <message>
                    <translation>Please file
                    the text field</translation>
                    </message>

                    Could you please explain how is it working with your solutions "lupdate -idbased your_project.pro"
                    
                    Pablo J. RoginaP 1 Reply Last reply
                    0
                    • D Dhiru

                      @Pablo-J.-Rogina Also i have same type issue which I fixed on one way to after next line character put on next line like below.
                      <message>
                      <translation>Please file
                      the text field</translation>
                      </message>

                      Could you please explain how is it working with your solutions "lupdate -idbased your_project.pro"
                      
                      Pablo J. RoginaP Offline
                      Pablo J. RoginaP Offline
                      Pablo J. Rogina
                      wrote on last edited by
                      #20

                      @Dhiru I don't understand your question in full, but the -idbased parameter is used when the original string i.e. what's enclosed in tr() method is a text id, not the full text

                      Upvote the answer(s) that helped you solve the issue
                      Use "Topic Tools" button to mark your post as Solved
                      Add screenshots via postimage.org
                      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                      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