Bug 954505 - yast ruby msg extractor (xgettext) does not support format marker
Summary: yast ruby msg extractor (xgettext) does not support format marker
Status: RESOLVED FIXED
: 1088121 (view as bug list)
Alias: None
Product: openSUSE Distribution
Classification: openSUSE
Component: YaST2 (show other bugs)
Version: Leap 15.0
Hardware: All All
: P2 - High : Major with 1 vote (vote)
Target Milestone: ---
Assignee: Stefan Hundhammer
QA Contact: Jiri Srain
URL: https://trello.com/c/Z4PNrMjq
Whiteboard:
Keywords:
Depends on: 954357
Blocks: 1046572 1026156 1047617
  Show dependency treegraph
 
Reported: 2015-11-10 16:59 UTC by Karl Eichwalder
Modified: 2020-05-06 15:39 UTC (History)
10 users (show)

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


Attachments
List of broken translations (37.54 KB, text/plain)
2018-04-05 14:49 UTC, Ladislav Slezák
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Eichwalder 2015-11-10 16:59:25 UTC
+++ This bug was initially created as a clone of Bug #954357 +++

When installing Leap 42.1 (or 13.2) with Ukrainian localization the page of user account setup is skipped with error:

Details: malformed format string - %*[0-9]
Caller: /usr/lib64/ruby/gems/2.1.0/gems/fast_gettext-0.9.2/lib/fast_gettext/vendor/string.rb:70:in `%'

Other tried localizations show user account page correctly.
y2logs is attached

=============================================================================

 Karl Eichwalder 2015-11-10 17:36:40 CET

(In reply to Ancor Gonzalez Sosa from comment #5)
> Silly me! I was looking at Estonian .po file (et) and checking the effect in
> Greek language (el). But turns out el!=et. :-)
> 
> In Estonian it's not broken just because the translation is marked as fuzzy
> (so not included in the .mo file)... a missing translation that is not that
> obvious when you are staring at a Greek screen and you see no English text.
> :-D
> 
> So, in the end, it's a bug in the uk/users.po, as expected from the very
> beginning. So reassigning to translations.

Ok, thanks for debugging.  It would work better, if the ruby xgettext extractor would add formatting markers as it does for other languages such as c or even ycp:

#, c-format

#, ycp-format

I'm not sure whether that's a general issue or whether our yast xgettext extractor just does not know about this.  Without such markers we are not (easily) able to validate the translations -- we usually do this with msgfmt.
Comment 1 Ancor Gonzalez Sosa 2015-11-11 11:23:56 UTC
Added to YaST Team Scrum queue for the issue to be prioritized with the other tasks.
Comment 2 Ludwig Nussel 2017-07-11 11:01:11 UTC
Raising priority. Broken translations are repeatedly a source of crashes in the installer.
Comment 4 Luciano Santos 2018-02-27 00:37:30 UTC
A user have reported that when trying to install TW 20180222 with German locale (de_DE.UTF-8) he got this same error in Keyboard Settings (required for vconsole):  
malformed format string - % ...  
/usr/lib64/ruby/gems/2.5.0/gems/fast_gettext-1.6.0/lib/fast_gettext/vendor/string.rb:70:in `%'
Comment 5 Luciano Santos 2018-02-27 01:07:07 UTC
(In reply to Luciano Santos from comment #4)
> A user have reported that when trying to install TW 20180222 with German
> locale (de_DE.UTF-8) he got this same error in Keyboard Settings (required
> for vconsole):  
> malformed format string - % ...  
> /usr/lib64/ruby/gems/2.5.0/gems/fast_gettext-1.6.0/lib/fast_gettext/vendor/
> string.rb:70:in `%'

Sorry, I gave a wrong information. The system was installed but failed at startup when vconsole was being set.
Comment 6 Ancor Gonzalez Sosa 2018-02-27 09:00:15 UTC
(In reply to Luciano Santos from comment #4)
> A user have reported that when trying to install TW 20180222 with German
> locale (de_DE.UTF-8) he got this same error in Keyboard Settings (required
> for vconsole):  
> malformed format string - % ...  
> /usr/lib64/ruby/gems/2.5.0/gems/fast_gettext-1.6.0/lib/fast_gettext/vendor/
> string.rb:70:in `%'

Which typically means an error in the translated string (German in this case). The translator didn't respect the number and shape of all the placeholders.
Comment 7 Karl Eichwalder 2018-02-27 09:28:01 UTC
(In reply to Ancor Gonzalez Sosa from comment #6)
> Which typically means an error in the translated string (German in this
> case). The translator didn't respect the number and shape of all the
> placeholders.

As long as nobody take the time to work with gettext upstream maintainers to add proper ruby support, this will happen again and again.  Also see Ludwig's #c2.

(In the past I did this for ycp.)
Comment 10 Ludwig Nussel 2018-04-04 12:50:24 UTC
this is a SLE 15 problem now and a pretty nasty one. Typos of translators go unnoticed and take can down the installer :-( given that translations are often late, lack of qa checks here really hurts.
Comment 11 Josef Reidinger 2018-04-04 14:50:29 UTC
JFYI related source code including ycp one is at http://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-tools/src
Comment 12 Lukas Ocilka 2018-04-05 07:15:37 UTC
If translators are introducing typos, then it asks for a better translation
process. This is a "side note", but very important. We use code-reviews
in YaST. If translators do not use anything like that (and spell-checker),
then we ask for bigger problems.
Comment 13 Kai Dupke 2018-04-05 10:17:14 UTC
(In reply to Lukas Ocilka from comment #12)
> If translators are introducing typos, then it asks for a better translation
> process. 

Of course we ever need better processes for everything.

But.

Garbage in, garbage out is the old saying.

I'm fine with it (but if garbage can be identified aka filtered that should be done as some protecting step), but in this case it is 'garbage in, system die'.

This is a clear bug and must not happen.
Comment 14 Lukas Ocilka 2018-04-05 11:53:17 UTC
Yes, we are already looking for some garbage cleaner solution.
Of course, this will not fix the problem of broken translations.
It will just refuse to be killed by the trash, so it's a hotfix.
Comment 15 Ladislav Slezák 2018-04-05 14:49:36 UTC
Created attachment 766130 [details]
List of broken translations

My simple script found 167 broken translations
Comment 16 Kai Dupke 2018-04-05 14:53:02 UTC
(In reply to Ladislav Slezák from comment #15)
> Created attachment 766130 [details]
> List of broken translations
> 
> My simple script found 167 broken translations

Sounds like good input for the translation team.

Also sounds like you already have a filter you could use. Only question is where the filter should run, in YaST or before?
Comment 17 Dominique Leuenberger 2018-04-05 14:56:08 UTC
(In reply to Kai Dupke from comment #16)
> Also sounds like you already have a filter you could use. Only question is
> where the filter should run, in YaST or before?

Sounds like a task for the CI, before things end up broken in a package
Comment 18 Josef Reidinger 2018-04-05 14:59:34 UTC
(In reply to Kai Dupke from comment #16)
> (In reply to Ladislav Slezák from comment #15)
> > Created attachment 766130 [details]
> > List of broken translations
> > 
> > My simple script found 167 broken translations
> 
> Sounds like good input for the translation team.
> 
> Also sounds like you already have a filter you could use. Only question is
> where the filter should run, in YaST or before?

ideally in weblate. If we can inject own script, then we can avoid modify gettext in C.
Comment 19 Steffen Winterfeldt 2018-04-05 15:25:32 UTC
See bug  1088113 for the weblate side.

But even without new code, tagging the texts as c-format or python-brace-format (even if this leaves out the '%') would get us 90% there.
Comment 20 Steffen Winterfeldt 2018-04-06 11:52:48 UTC
*** Bug 1088121 has been marked as a duplicate of this bug. ***
Comment 21 Ladislav Slezák 2018-04-06 14:56:07 UTC
Just for the record, the is also a card for the YaST workshop: https://trello.com/c/nx1ktW0a/22-refactor-and-cleanup-the-translation-process
Comment 22 Tomáš Chvátal 2018-08-01 11:25:28 UTC
Publishing the bug as we want to have community involved too.

It is based of SLE15 if someone later tries on what codestreams need to be updated.
Comment 23 Stefan Hundhammer 2020-04-30 15:32:31 UTC
WIP: https://github.com/yast/yast-devtools/pull/152
Comment 24 Stefan Hundhammer 2020-05-05 13:28:46 UTC
Please read the extensive documentation at the pull request to get an idea how this works:

  https://github.com/yast/yast-devtools/pull/152

In a nutshell, we manually add different types of format markers for the different kinds of format that we use; so "msgfmt -c" or "msgmerge -c" should catch any errors in the translations.

The script is normally part of our translation process when generating .pot files, but it can also be invoked standalone.

Feel free to test and experiment.
Comment 25 Stefan Hundhammer 2020-05-06 15:30:59 UTC
The fix will become available with yast2-devtools-4.2.6.

But it can already be used independently if downloaded from here:

  https://github.com/yast/yast-devtools/blob/master/build-tools/scripts/po_add_format_hints

It doesn't need any YaST development environment, only Ruby (which all SUSE users should have installed anyway for YaST) and the "gettext" Ruby gem for that Ruby version (see ruby --version)

  sudo zypper in ruby2.6-rubygem-gettext

For more details, see

  https://github.com/yast/yast-devtools/pull/152


All YaST .pot files that we generate from now on should already contain format flags generated by this script, so they will trickle down to the translators with the normal translation workflow.