After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735413 - Use ngettext for "minutes" and "minutes"
Use ngettext for "minutes" and "minutes"
Status: RESOLVED FIXED
Product: gnome-sudoku
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-sudoku-maint
gnome-sudoku-maint
Depends on:
Blocks:
 
 
Reported: 2014-08-25 21:38 UTC by Alexandre Franke
Modified: 2014-08-28 21:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make a string easier to translate (2.54 KB, patch)
2014-08-26 03:46 UTC, Michael Catanzaro
none Details | Review
Better translator comment. (2.54 KB, patch)
2014-08-26 03:49 UTC, Michael Catanzaro
none Details | Review
Actually use a better translator comment (2.48 KB, patch)
2014-08-26 03:51 UTC, Michael Catanzaro
committed Details | Review

Description Alexandre Franke 2014-08-25 21:38:18 UTC
An i18n regression was recently introduced.

The string "%d minute"/"%d minutes" has been replaced by some code that constructs the sentence by appending %d and the translated "minute"/"minutes" by hand instead of relying on ngettext.

See https://wiki.gnome.org/TranslationProject/DevGuidelines/Plurals
Comment 1 Alexandre Franke 2014-08-25 21:38:50 UTC
The relevant file is lib/sudoku-game.vala
Comment 2 Michael Catanzaro 2014-08-25 22:03:41 UTC
I think you're looking at bug #731139, which has already been fixed. Are you sure you're looking at the latest version of the code?
Comment 3 Alexandre Franke 2014-08-25 22:14:29 UTC
Sorry, the issue is actually somewhat different from what I told, but it still exists: the code does use ngettext so that's not an issue; however it still appends %d and the translation of "minute"/"minutes" which is wrong.

Do:
ngettext("%d minute", "%d minutes", minutes);

Don't do:
var minute_string = ngettext ("minute", "minutes", minutes);
var time_string = "%d %s".printf (minutes, minute_string);

Also I'm not sure the way you then insert that string in another string is that good an idea.

I'd avoid:
var time_str = SudokuGame.seconds_to_minutes_string (time);
new MessageDialog (…, _("Well done, you completed the puzzle in %s"), time_str);

Instead I'd rather have seconds_to_minutes_string directly return the full string. So you'd have something like:
ngettext("Well done, you completed the puzzle in %d minute", "Well done, you completed the puzzle in %d minutes", minutes);
Comment 4 Michael Catanzaro 2014-08-26 03:46:34 UTC
Created attachment 284472 [details] [review]
Make a string easier to translate

Also, remove this logic from SudokuGame.vala, since it makes absolutely
no sense to have it there.

Hope this doesn't break anything....
Comment 5 Michael Catanzaro 2014-08-26 03:49:05 UTC
Created attachment 284473 [details] [review]
Better translator comment.
Comment 6 Michael Catanzaro 2014-08-26 03:51:56 UTC
Created attachment 284474 [details] [review]
Actually use a better translator comment

Apparently committing things is hard for me today.
Comment 7 Alexandre Franke 2014-08-26 10:58:27 UTC
Thanks, that would indeed solve the issue!