https://bugs.kde.org/show_bug.cgi?id=525730

            Bug ID: 525730
           Summary: parseZoomString fails on localized Arabic percent sign
                    (U+066A), causing false positive translation warnings
    Classification: Applications
           Product: okular
      Version First 26.08.1
       Reported In:
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION
When Okular is run in an Arabic locale and the translation for %1% uses the
standard Arabic Percent Sign (٪, U+066A), Okular emits a qWarning stating
"Wrong translation of zoom percentage. Please file a bug" and falls back to
standard ASCII rendering (%1%).

STEPS TO REPRODUCE
1. run okluar with Arabic locale, from Konsole:
LANGUAGE=ar_OM:ar LC_ALL=ar_OM.UTF-8 okular 

OBSERVED RESULT
This error printed:
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug
Wrong translation of zoom percentage. Please file a bug

EXPECTED RESULT
no error should be shown. 

Root Cause
In Okular's zoom management code, the localized zoom string undergoes a
round-trip validation check to verify that the translated string can be
successfully parsed back into the expected numerical value:
const QString localizedValue = makePrettyZoomString(value);
        const QString i18nZoomName = i18nc("Zoom percentage value %1 will be
replaced by the actual zoom factor value, so make sure you include it in your
translation in order to not to break anything", "%1%", localizedValue);
        if (makePrettyZoomString(parseZoomString(i18nZoomName)) ==
localizedValue) {
            translated << i18nZoomName;
        } else {
            qWarning() << "Wrong translation of zoom percentage. Please file a
bug";
            translated << QStringLiteral("%1%").arg(localizedValue);

The underlying parseZoomString() function only strips/expects the ASCII %
(U+0025). When it encounters the localized Arabic percentage character ٪
(U+066A), parseZoomString() fails to parse the string into a valid number.

In Arabic and all the language which used Arabic script, Arabic Percent Sign
(٪, U+066A) is used. 
in the PO file the %1% entry is translated to %1٪ which is correct way in
Arabic language.

By modifying the parseZoomString() to handle U+066A same as % and &, will solve
the issue.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 46
KDE Plasma Version: 6.7.5
KDE Frameworks Version: 6.30.0
Qt Version: 6.11.2
Kernel Version: 7.3.0-0.rc0.260819gbd5f485f3f02.5.fc46.x86_64 (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to