From d5f00591cd2022d17902e56737d54da036231d30 Mon Sep 17 00:00:00 2001 From: Emir SARI Date: Wed, 5 Mar 2025 17:10:01 +0300 Subject: [PATCH] QProgressBar: Make the default value translatable QProgressBar currently does not expose the default value for translation automatically. This is an issue for languages that use a different percent formatting other than the standard 100%. Default format has to be made explicitly available for translation, and it is not common among the most Qt and KDE software. This aims to fix the issue via making it available for translation, so that it could be translated at one source instead of fixing it in various software. Fixes: QTBUG-127713 Change-Id: Icd73cf48ad3cdf441e8e7aba58151cc538adff6a Reviewed-by: Volker Hilsheimer --- src/widgets/widgets/qprogressbar.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp index 01eb1b00815..530b1737894 100644 --- a/src/widgets/widgets/qprogressbar.cpp +++ b/src/widgets/widgets/qprogressbar.cpp @@ -54,7 +54,14 @@ QProgressBarPrivate::QProgressBarPrivate() void QProgressBarPrivate::initDefaultFormat() { - if (defaultFormat) + if (defaultFormat) { + //: %p is the percent value, % is the percent sign. When translated + //: to the identical %p%, then the second % symbol will be replaced + //: by the percentage-symbol from the user's locale. + format = QProgressBar::tr("%p%"); + } + + if (format == "%p%"_L1) format = "%p"_L1 + locale.percent(); }