[four-in-a-row] Fix translations.



commit 6bd79f30898bae9e29fb4b85d07ef8b6809c8a7b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Dec 23 09:33:58 2019 +0100

    Fix translations.

 src/scorebox.vala |  8 ++++----
 src/theme.vala    | 27 ++++++++++++++++++++++-----
 2 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/src/scorebox.vala b/src/scorebox.vala
index 782e21d..58feda5 100644
--- a/src/scorebox.vala
+++ b/src/scorebox.vala
@@ -117,14 +117,14 @@ private class Scorebox : Dialog {
             }
         } else {
             if (scores[Player.HUMAN] >= scores[Player.OPPONENT]) {
-                label_name_top.label = theme_get_player(Player.HUMAN,    (uint8) theme_id);    // FIXME 
missing ":" at end
-                label_name_mid.label = theme_get_player(Player.OPPONENT, (uint8) theme_id);    // idem
+                label_name_top.label = theme_get_player(Player.HUMAN,    (uint8) theme_id, /* with colon */ 
true);
+                label_name_mid.label = theme_get_player(Player.OPPONENT, (uint8) theme_id, /* with colon */ 
true);
 
                 label_score_top.label = scores[Player.HUMAN].to_string();
                 label_score_mid.label = scores[Player.OPPONENT].to_string();
             } else {
-                label_name_top.label = theme_get_player(Player.OPPONENT, (uint8) theme_id);    // FIXME 
missing ":" at end
-                label_name_mid.label = theme_get_player(Player.HUMAN,    (uint8) theme_id);    // idem
+                label_name_top.label = theme_get_player(Player.OPPONENT, (uint8) theme_id, /* with colon */ 
true);
+                label_name_mid.label = theme_get_player(Player.HUMAN,    (uint8) theme_id, /* with colon */ 
true);
 
                 label_score_top.label = scores[Player.OPPONENT].to_string();
                 label_score_mid.label = scores[Player.HUMAN].to_string();
diff --git a/src/theme.vala b/src/theme.vala
index e237b30..2c29474 100644
--- a/src/theme.vala
+++ b/src/theme.vala
@@ -26,6 +26,8 @@ private struct Theme
     public string grid_color;
     public string player1;
     public string player2;
+    public string player1_with_colon;
+    public string player2_with_colon;
     public string player1_win;
     public string player2_win;
     public string player1_turn;
@@ -41,7 +43,7 @@ private const string theme_gettext_package = GETTEXT_PACKAGE;
 
 private static string theme_get_title (uint8 id)
 {
-    return _(theme [id].title); // FIXME this gettext call feels horrible
+    return _(theme [id].title); // FIXME this gettext call feels horrible 1/5
 }
 
 private static string theme_get_player_turn (Player who, uint8 theme_id)
@@ -60,12 +62,22 @@ private static string theme_get_player_win (Player who, uint8 theme_id)
         return theme [theme_id].player2_win;
 }
 
-private static string theme_get_player (Player who, uint8 theme_id)
+private static string theme_get_player (Player who, uint8 theme_id, bool with_colon)
 {
-    if (who == Player.HUMAN)
-        return theme [theme_id].player1;
+    if (with_colon)
+    {
+        if (who == Player.HUMAN)
+            return _(theme [theme_id].player1_with_colon);  // FIXME this gettext call feels horrible 2/5
+        else
+            return _(theme [theme_id].player2_with_colon);  // FIXME this gettext call feels horrible 3/5
+    }
     else
-        return theme [theme_id].player2;
+    {
+        if (who == Player.HUMAN)
+            return _(theme [theme_id].player1);             // FIXME this gettext call feels horrible 4/5
+        else
+            return _(theme [theme_id].player2);             // FIXME this gettext call feels horrible 5/5
+    }
 }
 
 private const Theme theme [] = {
@@ -76,6 +88,7 @@ private const Theme theme [] = {
         null,
         "#000000",
         N_("Circle"),           N_("Cross"),
+        N_("Circle:"),          N_("Cross:"),
         N_("Circle wins!"),     N_("Cross wins!"),
         N_("Circle’s turn"),    N_("Cross’s turn")
     },
@@ -86,6 +99,7 @@ private const Theme theme [] = {
         null,
         "#FFFFFF",
         N_("Circle"),           N_("Cross"),
+        N_("Circle:"),          N_("Cross:"),
         N_("Circle wins!"),     N_("Cross wins!"),
         N_("Circle’s turn"),    N_("Cross’s turn")
     },
@@ -96,6 +110,7 @@ private const Theme theme [] = {
         "bg_toplight.png",
         "#727F8C",
         N_("Red"),              N_("Green"),
+        N_("Red:"),             N_("Green:"),
         N_("Red wins!"),        N_("Green wins!"),
         N_("Red’s turn"),       N_("Green’s turn")
     },
@@ -106,6 +121,7 @@ private const Theme theme [] = {
         "bg_toplight.png",
         "#727F8C",
         N_("Blue"),             N_("Red"),
+        N_("Blue:"),            N_("Red:"),
         N_("Blue wins!"),       N_("Red wins!"),
         N_("Blue’s turn"),      N_("Red’s turn")
     },
@@ -116,6 +132,7 @@ private const Theme theme [] = {
         "bg_toplight.png",
         "#727F8C",
         N_("Red"),              N_("Green"),
+        N_("Red:"),             N_("Green:"),
         N_("Red wins!"),        N_("Green wins!"),
         N_("Red’s turn"),       N_("Green’s turn")
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]