Extra semicolons causing overly broad text matching

Frederik Schwarzer schwarzer at kde.org
Sun Sep 6 10:45:18 BST 2020


Hi Jakob,

first of all: nice catch!

I will fix those today.

However, it might be a good idea to catch these in the code as well.

Thanks for the report.

Cheers,
Frederik

On 9/6/20 1:22 AM, Jakob Petsovits wrote:
> Hi,
> 
> I ended up researching the root cause of https://phabricator.kde.org/D28458 - why would KRunner translate "1/2" to all kinds of units in German, but not in English? And after a few rounds of digging, I found the answer:
> 
> https://websvn.kde.org/*checkout*/trunk/l10n-kf5/de/messages/kunitconversion/kunitconversion5.po
> 
> Specifically these two entries:
> 
> #: volume.cpp:96
> #, kde-format
> msgctxt "unit synonyms for matching user input"
> msgid "cubic hectometer;cubic hectometers;hm³;hm/-3;hm^3;hm3"
> msgstr "Kubikhektometer;;hm³;hm^3;hm3"
> 
> #: force.cpp:192
> #, kde-format
> msgctxt "unit synonyms for matching user input"
> msgid "dyne;dynes;dyn"
> msgstr "dyn;"
> 
> The code treats anything before, between or after a semicolon as a synonym for the main unit name. After "Kubikhektometer" there are two semicolons, so the code thinks the empty space in between is a synonym for "cubic hectometer". Similarly, "dyn;" has a semicolon at the end and the code treats the empty space after the semicolon as a synonym for "dyn".
> 
> In both cases, removing the extra semicolon would resolve this issue. I'm also trying to put in a safeguard in the unit conversion code itself as https://invent.kde.org/frameworks/kunitconversion/-/merge_requests/4 but it's better to resolve it in both places if possible.
> 
> Please have a look if you can. Thanks!
> - Jakob
> 


More information about the kde-i18n-de mailing list