[gnome-mahjongg] Translate Scores dialog.



commit 842e2a6c0ae73de2b07b587ce45ae8d1620014ce
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Sep 19 02:36:20 2020 +0200

    Translate Scores dialog.
    
    Fixes #13.

 src/gnome-mahjongg.vala |  4 ++--
 src/score-dialog.vala   | 18 +++++++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/gnome-mahjongg.vala b/src/gnome-mahjongg.vala
index 5d15e56..be63d02 100644
--- a/src/gnome-mahjongg.vala
+++ b/src/gnome-mahjongg.vala
@@ -14,7 +14,7 @@ public class Mahjongg : Gtk.Application
 
     private History history;
 
-    private List<Map> maps = null;
+    private List<Map> maps = new List<Map> ();
 
     private Gtk.ApplicationWindow window;
     private Gtk.Label title;
@@ -389,7 +389,7 @@ public class Mahjongg : Gtk.Application
 
     private int show_scores (HistoryEntry? selected_entry = null, bool show_quit = false)
     {
-        var dialog = new ScoreDialog (history, selected_entry, show_quit);
+        var dialog = new ScoreDialog (history, selected_entry, show_quit, maps);
         dialog.modal = true;
         dialog.transient_for = window;
 
diff --git a/src/score-dialog.vala b/src/score-dialog.vala
index 82662cf..65bcaf0 100644
--- a/src/score-dialog.vala
+++ b/src/score-dialog.vala
@@ -16,9 +16,11 @@ public class ScoreDialog : Gtk.Dialog
     private Gtk.ListStore score_model;
     private Gtk.ComboBox size_combo;
     private Gtk.TreeView scores;
+    private unowned List<Map> maps;
 
-    public ScoreDialog (History history, HistoryEntry? selected_entry = null, bool show_quit = false)
+    public ScoreDialog (History history, HistoryEntry? selected_entry = null, bool show_quit = false, 
List<Map> maps)
     {
+        this.maps = maps;
         this.history = history;
         history.entry_added.connect (entry_added_cb);
         this.selected_entry = selected_entry;
@@ -162,10 +164,20 @@ public class ScoreDialog : Gtk.Dialog
 
         if (!have_size_entry)
         {
-            var label = "%s".printf (entry.name);
+            unowned List<Map> map = maps.first ();
+            string display_name = entry.name;
+            do
+            {
+                if (map.data.score_name == display_name)
+                {
+                    display_name = dpgettext2 (null, "mahjongg map name", map.data.name);
+                    break;
+                }
+            }
+            while ((map = map.next) != null);
 
             size_model.append (out iter);
-            size_model.set (iter, 0, label, 1, entry.name);
+            size_model.set (iter, 0, display_name, 1, entry.name);
 
             /* Select this entry if don't have any */
             if (size_combo.get_active () == -1)


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