Fix KI18n’s (I18N_ARGUMENT_MISSING) warnings in migration
ClosedPublic

Authored by jfita on May 16 2020, 11:49 PM.

Details

Summary

If there is any error during a migration, Kexi gets the error message
already formatted in HTML from KDb and tries to mix this error message
with a markup-aware KLocalizedString. However, KI18n escapes all QString
arguments and the user sees the HTML tags in the error message.
Therefore, it left out the replacement of placeholders until it got the
translated QString, avoiding the escaping.

However, when KI18n is compiled with NDEBUG defined it adds a
(I18N_ARGUMENT_MISSING) warning into the translated string when the
source has placeholders that have not been replaced.

The way of avoiding escaping with KI18n is to replace the placeholders
with another markup-aware KLocalizedString. That can be done in
checkUserInput because all the error messages are defined within the
function, but it is not possible with the error messages from KDb.

What i ended doing for these messages is to replace the placeholders
with themselves, so that KI18n does not warn about missing arguments but
the translated string sill has them and can call .arg() with KDb’s
HTML-formatted error messages.

FIXED-IN:3.2.1

Diff Detail

Repository
R71 Kexi
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
jfita created this revision.May 16 2020, 11:49 PM
Restricted Application added a project: KEXI. · View Herald TranscriptMay 16 2020, 11:49 PM
Restricted Application added a subscriber: Kexi-Devel-list. · View Herald Transcript
jfita requested review of this revision.May 16 2020, 11:49 PM
staniek accepted this revision.May 17 2020, 7:59 AM

Good job!

This revision is now accepted and ready to land.May 17 2020, 7:59 AM
This revision was automatically updated to reflect the committed changes.