Lupdate and macros



  • Hi all,
    I develop multilanguage software and use QObject::tr for translate.
    In my case I also use a specific macros and some of them expand in text which must be translated.
    I wrapped the text in macros that need to be translated in QObject::tr but lupdate doesn't see these lines. In the preprocessed files I see this text with QObject::tr.
    Is there any way to make lupdate see these lines of text?


  • Moderators

    @sailor.steve said in Lupdate and macros:

    Is there any way to make lupdate see these lines of text?

    Move the texts out of macros. Make them static variables, members of some singleton - whatever. lupdate just does not get macros.



  • @sailor.steve said in Lupdate and macros:

    I wrapped the text in macros that need to be translated

    In addition to @sierdzio response, please keep in mind that Qt translation tools use the "original" text as the key for looking the proper translation in the available loaded Qt translator object, and if such string is not found, that same string is displayed instead.

    This is a little bit different from some other translation tools that use "constants" (i.e. macro?) as the key and then you provide a file with constant -> translation pairs.