Bug 302841

Summary: Additional parentheses at the end of strings finished in parentheses added from an alternative translation
Product: [Applications] lokalize Reporter: Adrián Chaves (Gallaecio) <adrian>
Component: editorAssignee: Adrián Chaves (Gallaecio) <adrian>
Status: CONFIRMED ---    
Severity: minor CC: aspotashev, karl, pavel.horal
Priority: NOR    
Version First Reported In: 1.4   
Target Milestone: ---   
Platform: Chakra   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Adrián Chaves (Gallaecio) 2012-07-01 16:02:17 UTC
For example, if the alternative translation field has the content “Branco-Cinzento (horizontal)” and I get it copied to the main field, a parentheses, “)”, is attached at the end, resulting in the main translation field being filled with the following string: “Branco-Cinzento (horizontal))”.

Reproducible: Always
Comment 1 Karl Ove Hufthammer 2015-06-05 18:48:54 UTC
I can confirm this with the latest Lokalize version. It also happens with other punctuation (e.g., a full stop: .).

One example I tried makes me *suspect* that the extra character is actually from the original (English) string, not from the alternative translation.
Comment 2 Pavel Horal 2022-03-13 20:31:13 UTC
This is caused by some "magic" (this word is used in the code itself) trying to preserve non-word characters at the start and end of the string:

- https://invent.kde.org/sdk/lokalize/-/blob/master/src/tm/tmview.cpp#L830

This feature was introduced 14 years ago and I am not sure what was the original motivation - https://invent.kde.org/sdk/lokalize/-/commit/3765f371f02b4a2b33118c0e7f95e3fc5ae6134f . It might make sense in some very limited use case related to KDE. Would be nice if this "black magic" can be at least turn off if not completely removed.

Disclamer: I am not KDE app developer and I am using (or trying to use) Lokalize for personal translation project.