Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Unsolved Lupdate and macros

    General and Desktop
    lupdate macros translate
    3
    3
    810
    Loading More Posts
    • 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.
    • S
      sailor.steve last edited by

      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?

      sierdzio Pablo J. Rogina 2 Replies Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators @sailor.steve last edited by

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

        (Z(:^

        1 Reply Last reply Reply Quote 2
        • Pablo J. Rogina
          Pablo J. Rogina @sailor.steve last edited by

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

          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 Reply Quote 2
          • First post
            Last post