The output file name must be kcm_kscreen.po for translators to pick it up and
text being split to respect the 100 chars line limit must first be translated
before being merged together again.
Details
- Reviewers
victorr yurchor - Group Reviewers
Plasma - Commits
- R104:a798e78d477e: [kcm] Fix i18n output file name and split texts
KCM starts without errors.
Diff Detail
- Repository
- R104 KScreen
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Please do not split the messages just for sake of column width.
What about just removing the + to concatenate the strings, and just use normal continuation, i.e.:
text: i18n("Are you sure you want to disable all outputs? " "This might render the device unusable.")
If there is a better solution than splitting text with a + while still respecting the line chars limit I will upload a new patch.
What about just removing the + to concatenate the strings, and just use normal continuation, i.e.:
text: i18n("Are you sure you want to disable all outputs? " "This might render the device unusable.")
This sadly didn't work. The KCM just doesn't start then with an error message. Does the macro need to be improved to support this?
Even reading the other RR, I still do not understand how this 100 chars limit is so important, even to make i18n worse.
What about just removing the + to concatenate the strings, and just use normal continuation, i.e.:
text: i18n("Are you sure you want to disable all outputs? " "This might render the device unusable.")This sadly didn't work. The KCM just doesn't start then with an error message. Does the macro need to be improved to support this?
Which macro?
diff --git a/kcm/package/contents/ui/main.qml b/kcm/package/contents/ui/main.qml index 2e61aa5..191daf3 100644 --- a/kcm/package/contents/ui/main.qml +++ b/kcm/package/contents/ui/main.qml @@ -41,8 +41,8 @@ KCM.SimpleKCM { Layout.fillWidth: true type: Kirigami.MessageType.Warning - text: i18n("Are you sure you want to disable all outputs? ") + - i18n("This might render the device unusable.") + text: i18n("Are you sure you want to disable all outputs? \ +This might render the device unusable.") showCloseButton: true actions: [
This also works, but it's ugly because the second line has not the right indent.
Pick your choice: this, or single-line messages. Either of them is way better than the currently committed hack.
If it's just a QML function why is it a problem to + some strings when providing them as an argument?
EDIT: I noticed there was an additional white space in the first version. Could this be the problem?
This is not a "problem" when translating the string at runtime, but rather when extracting it (with xgettext).
(x)gettext extracts only string literals, and a string concatenation is not (they are two strings, actually). This is why continuation lines do not pose issue: they are still a single literal string.
BTW: if by 2200 UTC none of the two solutions mentioned above (continuation lines, or single long lines) is implemented, I will revert the majority of a798e78d477e (leaving only the .pot renaming, which is correct).
@ltoscano The plus sign does not work.
This string:
text: i18n("Are you sure you want to disable all outputs? " + "This might render the device unusable.")
is extracted like Are you sure you want to disable all outputs?