[gnome-nibbles/wip/vala] Don't use string templates for translatable strings
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nibbles/wip/vala] Don't use string templates for translatable strings
- Date: Sun, 20 Sep 2015 18:28:39 +0000 (UTC)
commit 2c16533c7b653e31cdfd9ce2caae2abf27701691
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Sep 20 13:23:38 2015 -0500
Don't use string templates for translatable strings
I'm not sure if this even works, and it's definitely confusing for
translators. Also, use ngettext.
src/gnome-nibbles.vala | 9 +++++----
src/nibbles-view.vala | 4 +++-
2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/gnome-nibbles.vala b/src/gnome-nibbles.vala
index 0baf4fd..3cf9b3b 100644
--- a/src/gnome-nibbles.vala
+++ b/src/gnome-nibbles.vala
@@ -654,7 +654,8 @@ public class Nibbles : Gtk.Application
new_game_action.set_enabled (false);
pause_action.set_enabled (false);
- var label = new Gtk.Label (_(@"Level $(game.current_level) Completed!"));
+ // Translators: the %d is the number of the level that was completed.
+ var label = new Gtk.Label (_("Level %d Completed!").printf (game.current_level));
label.halign = Gtk.Align.CENTER;
label.valign = Gtk.Align.START;
label.set_margin_top (150);
@@ -704,8 +705,8 @@ public class Nibbles : Gtk.Application
game_over_label.get_style_context ().add_class ("menu-title");
game_over_label.show ();
- var points = score > 1 ? "Points" : "Point";
- var score_label = new Gtk.Label (_(@"<b>$(score) $(points)</b>"));
+ var score_string = ngettext ("%d Point".printf (score), "%d Points".printf (score), score);
+ var score_label = new Gtk.Label (@"<b>$(score_string)</b>");
score_label.set_use_markup (true);
score_label.halign = Gtk.Align.CENTER;
score_label.valign = Gtk.Align.START;
@@ -713,7 +714,7 @@ public class Nibbles : Gtk.Application
score_label.show ();
var points_left = last_score - score;
- var points_left_label = new Gtk.Label (_(@"($(points_left) points to reach the leaderboard)"));
+ var points_left_label = new Gtk.Label (_("(%d points to reach the leaderboard)").printf
(points_left));
points_left_label.halign = Gtk.Align.CENTER;
points_left_label.valign = Gtk.Align.START;
points_left_label.set_margin_top (window_height / 3 + 100);
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index 7e89de0..b6a4c08 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -475,7 +475,9 @@ public class NibblesView : GtkClutter.Embed
{
var color = game.worm_props.get (worm).color;
- var label = new Clutter.Text.with_text ("Monospace 10", _(@"<b>Player $(worm.id + 1)</b>"));
+ /* Translators: the player's number, e.g. "Player 1" or "Player 2". */
+ var player_id = _("Player %d").printf (worm.id + 1);
+ var label = new Clutter.Text.with_text ("Monospace 10", @"<b>$(player_id)</b>");
label.set_use_markup (true);
label.set_color (Clutter.Color.from_string (colorval_name (color)));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]