Bug 1026156 - Weblate doesn't check for wrong "%s" variable
Summary: Weblate doesn't check for wrong "%s" variable
Status: RESOLVED DUPLICATE of bug 980329
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Translations (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: Karl Eichwalder
URL:
Whiteboard:
Keywords:
Depends on: 954505 980329
Blocks:
  Show dependency treegraph
 
Reported: 2017-02-20 13:35 UTC by Luiz Fernando Ranghetti
Modified: 2017-02-21 14:27 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luiz Fernando Ranghetti 2017-02-20 13:35:30 UTC
Hi,

Maybe Weblate should check for wrong translations on variable %s, because if it is translated wrong (%1, %d, etc) it can break the program like this bug for example:

https://bugzilla.suse.com/show_bug.cgi?id=1018576

Regards
Comment 1 Stanislav Brabec 2017-02-20 16:14:34 UTC
Weblate has the check built-in.

But the source of the string in the bug 1018576 does not specify type of formatting, so Weblate cannot enable the correct check.

https://docs.weblate.org/en/latest/user/checks.html#check-c-format

The fix is easy:

 #: src/lib/fonts/fonts-dialog.rb:328
+#, c-format
 msgid "<p><b>Specimen for %s</b></p>"
 msgstr ""

Looking at the YaST source, it is a very more generic problem:

78 of 97 pot files contain "%" character in some of its strings.

But only 5 yast pot files use "c-format" keyword.

Weblate is capable to enable particular check for all strings in a component, but I am not sure whether it is a good approach (configuration section Quality checks flags). It would force the format checks for all strings, idependently on a real use in the source. In some cases it can block correct translation (e. g. if the string with "%" character is not used in printf()-like context).
Comment 2 Luiz Fernando Ranghetti 2017-02-20 16:45:54 UTC
So it will be better to correct the yast code or the amount of work do not compensate the effort?

Maybe we should bring yast people to think about this bug.
Comment 3 Karl Eichwalder 2017-02-21 09:01:15 UTC
We already have:

https://bugzilla.suse.com/show_bug.cgi?id=980329
https://bugzilla.suse.com/show_bug.cgi?id=954505

It probably worth to follow up there ;-)
Comment 4 Stanislav Brabec 2017-02-21 14:19:20 UTC
It cannot be easily fixed on Weblate side. Without the format information, Weblate cannot decide whether it is a bug or not.

For example, for printf(), "%s" is a format specifier. For puts(), "%s" are just two normal characters.

In this particular case, it looks like a problem of gettext-tools not understanding ruby language:

_("<p><b>Specimen for %s</b></p>") % script

Tools should be able to detect that %s is a format specifier here, and generate the correct format comment. Weblate then will activate the check.
Comment 5 Luiz Fernando Ranghetti 2017-02-21 14:27:57 UTC
Thanks for the feedback!

So this bug is just a duplicate of 980329. I'll close it.

*** This bug has been marked as a duplicate of bug 980329 ***