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. [Solved] specify different context to tr?

[Solved] specify different context to tr?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.5k Views 1 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.
  • D Offline
    D Offline
    Davita
    wrote on last edited by
    #1

    Hi guys

    I have the following situation. I have 2 dialogs which share several texts. The problem I'm facing is that lupdate generates tr's constant in different <context> element, so I'm obligated to do translation of single texts multiple times.

    here's how it looks the generated ts file.
    @
    <context>
    <name>GenericAlert</name>
    <message>
    <location filename="genericalert.cpp" line="81"/>
    <source>CertVerified</source>
    </message>
    </context>

    <context>
    <name>ProcessStartAlert</name>
    <message>
    <location filename="processstartalert.cpp" line="66"/>
    <location filename="processstartalert.cpp" line="86"/>
    <source>CertVerified</source>
    </message>
    </context>
    @

    Now I want to have single CertVerified for both dialogs. Is this possible at all?

    Than you very much :)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      The static "QCoreApplication::translate() ":http://doc.qt.nokia.com/4.7/qcoreapplication.html#translate methods could be of use in this case. You can explicitly set a context there.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Davita
        wrote on last edited by
        #3

        Thanks Volker, it worked :)

        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