aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-02-14 12:10:53 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-02-14 12:21:34 +0100
commitec66d06e6ef38b4c2cf2246ba2eeb3d17a6040e5 (patch)
treeeccd7c588c7bd2982e823809c4efc902a18fe211 /contrib
parentd978c41e1ec4fcf2c4d096f09af035f9e8a7ad81 (diff)
parent7179e7ca0db493dccbfd88f64738252844aab6ff (diff)
Merge #9735: devtools: Handle Qt formatting characters edge-case in update-translations.py
7179e7c qt: Periodic translations update (Wladimir J. van der Laan) 5e903a5 devtools: Handle Qt formatting characters edge-case in update-translations.py (Wladimir J. van der Laan)
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/devtools/update-translations.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/devtools/update-translations.py b/contrib/devtools/update-translations.py
index 78b9f9d179..2011841005 100755
--- a/contrib/devtools/update-translations.py
+++ b/contrib/devtools/update-translations.py
@@ -65,6 +65,14 @@ def split_format_specifiers(specifiers):
else:
other.append(s)
+ # If both numeric format specifiers and "others" are used, assume we're dealing
+ # with a Qt-formatted message. In the case of Qt formatting (see https://doc.qt.io/qt-5/qstring.html#arg)
+ # only numeric formats are replaced at all. This means "(percentage: %1%)" is valid, without needing
+ # any kind of escaping that would be necessary for strprintf. Without this, this function
+ # would wrongly detect '%)' as a printf format specifier.
+ if numeric:
+ other = []
+
# numeric (Qt) can be present in any order, others (strprintf) must be in specified order
return set(numeric),other