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. How to run lupdate with a QMAKE CONFIG?
Forum Updated to NodeBB v4.3 + New Features

How to run lupdate with a QMAKE CONFIG?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 508 Views 2 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
    devjb
    wrote on last edited by devjb
    #1

    I posted the same question on stackoverflow after a few days:

    https://stackoverflow.com/questions/58029996/how-to-run-qts-lupdate-tool-with-a-qmake-config

    .

    .

    .

    .

    I use such a construct in my project files:

    LANGUAGES = de
    TRANSLATION_NAME = authorization
    include(../../gen_translations.pri)
    

    where gen_translations.pri looks like so:

    # parameters: var, prepend, append
    defineReplace(prependAll) {
     for(a,$$1):result += $$2$${a}$$3
     return($$result)
    }
    
    TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/libs/$$TRANSLATION_NAME/translations/lib$${TRANSLATION_NAME}_, .ts)
    
    TRANSLATIONS_FILES =
    
    qtPrepareTool(LRELEASE, lrelease)
    
    for(tsfile, TRANSLATIONS) {
     qmfile = $$shadowed($$tsfile)
     qmfile ~= s,.ts$,.qm,
     qmdir = $$dirname(qmfile)
     !exists($$qmdir) {
     mkpath($$qmdir)|error("Aborting.")
     }
     command = $$LRELEASE -removeidentical $$tsfile -qm $$qmfile
     system($$command)|error("Failed to run: $$command")
     TRANSLATIONS_FILES += $$qmfile
    }
    
    for(qmentry, $$list($$TRANSLATIONS_FILES)) {
      qmpath = $$OUT_PWD/../translations
      qmpathname = $$replace(qmpath,/,)
      qmpathname = $$replace(qmpathname,\.,)
      qmpathname = $$replace(qmpathname,:,)
      qmpathname = $$replace(qmpathname," ",)
      qmentity = qmfiles_$${qmpathname}
      eval($${qmentity}.files += $$qmentry)
      eval($${qmentity}.path = $$qmpath)
      INSTALLS *= $${qmentity}
    }
    

    It generates the *.qm files for me and moves them to a defined location with make install.

    I do not want qmake to execute that whole stuff for each build on my developing machine. Therefore I want to make the stuff conditional by wrapping it for qmake:

    translate{
    LANGUAGES = de
    TRANSLATION_NAME = authorization
    include(../../gen_translations.pri)
    }
    

    That way I can decide when I want to get *.qm files and when not.
    But then I am unable to run lupdate on the project file because it is blocked by that conditional.

    I am sure, that someone has a better idea to accomplish the task.

    Thanks in advance.

    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