This PR fixes #33146, which may be considered a regression introduced in #31233.
This approach was chosen for its minimal diff.
An alternative approach would be to convert the translate
build target into a CMake script. This could be justified, as the goal is to update files in the source tree and then commit them to the repository, which is something regular build targets are not intended to do.
On a related note, the share/qt/extract_strings_qt.py
looks simple enough to be rewritten in pure CMake code.