[gnome-sudoku] Make a string easier to translate
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Make a string easier to translate
- Date: Thu, 28 Aug 2014 21:28:22 +0000 (UTC)
commit 4ca32808c3ccc62082129f5f89cdf52199d17078
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Aug 25 22:43:16 2014 -0500
Make a string easier to translate
Also, remove this logic from SudokuGame.vala, since it makes absolutely
no sense to have it there.
https://bugzilla.gnome.org/show_bug.cgi?id=735413
lib/sudoku-game.vala | 12 ------------
src/gnome-sudoku.vala | 9 +++++----
2 files changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/lib/sudoku-game.vala b/lib/sudoku-game.vala
index 74655fc..b32ff32 100644
--- a/lib/sudoku-game.vala
+++ b/lib/sudoku-game.vala
@@ -117,16 +117,4 @@ public class SudokuGame : Object
{
return board.previous_played_time + timer.elapsed ();
}
-
- public static string seconds_to_minutes_string (double time_in_seconds)
- {
- var minutes = (int) time_in_seconds / 60;
- if (minutes == 0)
- minutes = 1;
-
- var minute_string = ngettext ("minute", "minutes", minutes);
- var time_string = "%d %s".printf (minutes, minute_string);
-
- return time_string;
- }
}
diff --git a/src/gnome-sudoku.vala b/src/gnome-sudoku.vala
index b925659..b0354e9 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -237,16 +237,17 @@ public class Sudoku : Gtk.Application
});
game.board.completed.connect (() => {
- var time = game.get_total_time_played ();
- var time_str = SudokuGame.seconds_to_minutes_string (time);
-
for (var i = 0; i < game.board.rows; i++)
for (var j = 0; j < game.board.cols; j++)
view.can_focus = false;
saver.add_game_to_finished (game, true);
- var dialog = new MessageDialog (window, DialogFlags.DESTROY_WITH_PARENT, MessageType.INFO,
ButtonsType.NONE, _("Well done, you completed the puzzle in %s"), time_str);
+ /* Text in dialog that displays when the game is over. */
+ var time_str = ngettext ("Well done, you completed the puzzle in %d minute",
+ "Well done, you completed the puzzle in %d minutes",
+ int.max (1, (int) game.get_total_time_played () / 60));
+ var dialog = new MessageDialog (window, DialogFlags.DESTROY_WITH_PARENT, MessageType.INFO,
ButtonsType.NONE, time_str);
dialog.add_button (_("Same difficulty again"), 0);
dialog.add_button (_("New difficulty"), 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]