Using lupdate-pro
The lupdate-pro command line tool extracts translatable strings from qmake projects (.pro files) and updates TS files. It is specifically designed for qmake-based projects, while lupdate works with source files and JSON description files and is build-system agnostic.
Use lupdate-pro when you have a qmake project and want to extract translations based on the project structure defined in your .pro file.
lupdate-pro syntax
lupdate-pro [options] [project-file]... [-ts ts-files...]
Where:
optionsmeans one or several lupdate-pro options.project-fileis a .pro file to process.ts-filesare the TS files to generate or update.
To view the latest help, enter:
lupdate-pro -help
lupdate-pro options
| Option | Action |
|---|---|
-help | Display up-to-date help information and exit. |
-dump-json <file> | Generate a JSON project description file without processing translations. This file can be passed to lupdate or lrelease using the -project option. |
-silent | Do not explain what is being done. |
-pro <filename> | Name of a .pro file. Useful for files with .pro file syntax but different file suffix. Projects are recursed into and merged. |
-pro-out <directory> | Virtual output directory for processing subsequent .pro files. |
-pro-debug | Trace processing .pro files. Specify twice for more verbosity. |
-ts <ts-file>... | Specify the output TS files. This overrides TRANSLATIONS. |
-no-obsolete | Drop all obsolete and vanished strings. |
-pluralonly | Only include plural form messages. |
-no-sort | Do not sort contexts in TS files. |
-locations {absolute|relative|none} | Specify or override the way to save source code references in TS files. |
-no-ui-lines | Do not record line numbers in references to UI files. |
-source-language <language>[_<region>] | Specify the language of the source strings for new files. |
-target-language <language>[_<region>] | Specify the language of the translations for new files. |
-tr-function-alias <function>{+=,=}<alias> | Recognize <alias> as an alternative spelling of <function>. |
-version | Display the version of lupdate-pro and exit. |
Examples
Update translations from a qmake project
lupdate-pro myproject.pro
Generate JSON project description
Generate a JSON file describing the project structure for use with lupdate or lrelease:
lupdate-pro myproject.pro -dump-json project.json
Then use the generated JSON file with lupdate:
lupdate -project project.json
This two-step workflow is useful when you need to customize the project description or integrate with other tools.