[Solved] specify different context to tr?



  • 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 :)



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



  • Thanks Volker, it worked :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.