lupdate(1)

πŸ“¦
version 5.15.19 Β· 3 versions
, in ubuntu resolute, ubuntu stonking

✨ lupdate β€” the glow-up page for your translation files ✨

okay bestie, so this is the manual for lupdate, from the General Commands Manual section, and honestly? it's the tool that keeps your translations from being a whole mess. let's get into it πŸ’–


πŸŽ€ NAME πŸŽ€

lupdate β€” update Qt Linguist translation files


πŸ¦‹ SYNOPSIS πŸ¦‹

lupdate [ options ] project-file
lupdate [ options ] source-files -ts ts-files

πŸ’… DESCRIPTION πŸ’…

This page documents the Qt Linguist Update tool for the Qt GUI toolkit. no cap, that's the whole point of it.

lupdate reads a qmake/tmake project file (a .pro file), finds the translatable strings in the specified source, header and interface files, and updates the translation files (TS files) specified in it. Then those translation files get handed to the translator, who uses Qt Linguist to read the files and insert the translations. it's giving teamwork, fr fr 🫢

The TS file format is a simple human-readable XML format that can be used with version control systems if required. yes bestie, it plays nice with git. iconic. πŸ‘‘


✨ OPTIONS ✨

  • -disable-heuristic {sametext|similartext|number} β€” turn off the named merge heuristic. you can pass this multiple times if you're feeling thorough. πŸ™ˆ
  • -extensions <ext>[,<ext>...] β€” only process files with the given extensions. the extension list must be separated with commas, not with whitespace. default: 'ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx'.
  • -help β€” display the usage and exit. short and sweet, we love that.
  • -locations {absolute|relative|none} β€” specify/override how source code references are saved in TS files. default is absolute.
  • -no-obsolete β€” drop all obsolete strings. bye bye old stuff πŸ’€
  • -no-recursive β€” do not recursively scan the following directories.
  • -no-sort β€” do not sort contexts in TS files.
  • -pluralonly β€” only include plural form messages.
  • -pro <filename> β€” name of a .pro file. useful for files with .pro file syntax but a different file suffix.
  • -recursive β€” recursively scan the following directories.
  • -silent β€” do not explain what is being done. stealth mode 🧚
  • -source-language <language>[_<region>] β€” specify/override the language of the source strings. defaults to POSIX if not specified and the file does not name it yet.
  • -target-language <language>[_<region>] β€” specify/override the language of the translation. the target language is guessed from the file name if this option is not specified and the file contents name no language yet.
  • -tr-function-alias <function>{+=,=}<alias>[,<function>{+=,=}<alias>]... β€” with +=, recognize <alias> as an alternative spelling of <function>. with =, recognize <alias> as the only spelling of <function>. see lupdate -h for a list of available function names.
  • -version β€” display the version of lupdate and exit.

🌈 USAGE 🌈

Here is an example .pro file that can be given to lupdate:

HEADERS         = funnydialog.h \
                  wackywidget.h
SOURCES         = funnydialog.cpp \
                  main.cpp \
                  wackywidget.cpp
FORMS           = fancybox.ui
TRANSLATIONS    = gnomovision_dk.ts \
                  gnomovision_fi.ts \
                  gnomovision_no.ts \
                  gnomovision_se.ts

When running lupdate on this project file, the translatable strings in all the files listed in the HEADERS, SOURCES and FORMS entries will be put in the translation files listed in the TRANSLATIONS entry. Previous translations will be reused as far as possible, and translated strings that have vanished from the source files are marked obsolete. so nothing gets thrown away unless you want it gone, which is honestly so considerate 😭

lupdate can also be invoked with a list of C++ source files, UI files and TS files:

lupdate *.cpp *.h *.ui -ts gnomovision_dk.ts

πŸ‘€ SEE ALSO πŸ‘€

lrelease(1) and http://doc.qt.io/qt-5/qtwidgets-tools-i18n-example.html


go read those too bestie, iykyk πŸ’œ

and that's the whole page!! brought to you by The Qt Company Ltd., dated 18 October 2001, living under the name lupdate(1). slay, periodt. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from