Bug 357274 - Semantic tags not respected in nested xi18nc calls
Summary: Semantic tags not respected in nested xi18nc calls
Status: RESOLVED NOT A BUG
Alias: None
Product: frameworks-ki18n
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Chusslove Illich
URL:
Keywords:
: 357273 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-12-28 18:27 UTC by Elvis Angelaccio
Modified: 2015-12-29 13:59 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Results of nesting xi18nc calls with different context (14.75 KB, image/png)
2015-12-28 18:27 UTC, Elvis Angelaccio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elvis Angelaccio 2015-12-28 18:27:09 UTC
Similar to bug #357273, but now the two nested xi18n calls have differenct contexts: https://paste.kde.org/poeleukgb

As you can see in the attached screenshot, the semantic tag in the nested xi18nc() is not respected.

Reproducible: Always
Comment 1 Elvis Angelaccio 2015-12-28 18:27:44 UTC
Created attachment 96337 [details]
Results of nesting xi18nc calls with different context
Comment 2 Chusslove Illich 2015-12-29 13:22:22 UTC
*** Bug 357273 has been marked as a duplicate of this bug. ***
Comment 3 Chusslove Illich 2015-12-29 13:24:47 UTC
xi18n* call return a QString, and QString as argument to an *xi18n* call has to be escaped for XML, as it could be anything. For example, it could be a file path which happens to have something looking like a tag in it. So this behavior is as expected.

Instead, kxi18n* calls should be used for nesting. These return KLocalizedString, for which it is guaranteed that what looks like markup really is markup (as consequence of escaping any other argument type).

The section in documentation that talks about this:

http://api.kde.org/frameworks-api/frameworks5-apidocs/ki18n/html/prg_guide.html#kuit_escape
Comment 4 Elvis Angelaccio 2015-12-29 13:59:41 UTC
Thanks for the explanation :)
Unfortunately is not trivial to refactor existing code to support KLocalizedString. I guess I will simply avoid to use markup in the nested translated messages...