[lightsoff/arnaudb/save-state: 2/5] Add translators comments.




commit 9fd22b6cf5fa9215b1aafcc0fefb6968bcccfe3c
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Oct 28 16:23:57 2020 +0100

    Add translators comments.

 data/lightsoff-menus.ui              |  5 ++++
 data/org.gnome.LightsOff.gschema.xml |  2 ++
 src/board-view-gtk.vala              | 16 ++++++------
 src/board-view.vala                  |  1 +
 src/game-view-gtk.vala               | 24 ++++++++++++------
 src/game-view.vala                   |  1 +
 src/lightsoff-window.vala            |  5 ++--
 src/lightsoff.vala                   | 49 ++++++++++++++++++++++--------------
 8 files changed, 68 insertions(+), 35 deletions(-)
---
diff --git a/data/lightsoff-menus.ui b/data/lightsoff-menus.ui
index c6cb65a..d25a0eb 100644
--- a/data/lightsoff-menus.ui
+++ b/data/lightsoff-menus.ui
@@ -4,16 +4,19 @@
   <menu id="primary-menu">
     <section>
       <item>
+        <!-- Translators: entry of the window menu (with a mnemonic that appears when pressing Alt); 
restarts the current level  -->
         <attribute name="label" translatable="yes">_Start Over</attribute>
         <attribute name="action">win.new-game</attribute>
         <attribute name="accel">&lt;Primary&gt;n</attribute>
       </item>
       <item>
+        <!-- Translators: entry of the window menu (with a mnemonic that appears when pressing Alt); switch 
to previous level -->
         <attribute name="label" translatable="yes">_Previous puzzle</attribute>
         <attribute name="action">win.previous-level</attribute>
         <attribute name="accel">&lt;Primary&gt;Page_Up</attribute>
       </item>
       <item>
+        <!-- Translators: entry of the window menu (with a mnemonic that appears when pressing Alt); switch 
to next level -->
         <attribute name="label" translatable="yes">Ne_xt puzzle</attribute>
         <attribute name="action">win.next-level</attribute>
         <attribute name="accel">&lt;Primary&gt;Page_Down</attribute>
@@ -21,11 +24,13 @@
     </section>
     <section>
       <item>
+        <!-- Translators: entry of the window menu (with a mnemonic that appears when pressing Alt); show 
application help -->
         <attribute name="label" translatable="yes">_Help</attribute>
         <attribute name="action">app.help</attribute>
         <attribute name="accel">F1</attribute>
       </item>
       <item>
+        <!-- Translators: entry of the window menu (with a mnemonic that appears when pressing Alt); open 
About dialog -->
         <attribute name="label" translatable="yes">_About Lights Off</attribute>
         <attribute name="action">app.about</attribute>
       </item>
diff --git a/data/org.gnome.LightsOff.gschema.xml b/data/org.gnome.LightsOff.gschema.xml
index 43084fe..c33dd44 100644
--- a/data/org.gnome.LightsOff.gschema.xml
+++ b/data/org.gnome.LightsOff.gschema.xml
@@ -3,7 +3,9 @@
     <key name="level" type="i">
       <default>1</default>
       <range min="1" />
+      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/LightsOff/level' -->
       <summary>The current level</summary>
+      <!-- Translators: description of a settings key, see 'dconf-editor /org/gnome/LightsOff/level' -->
       <description>The users’s most recent level.</description>
     </key>
   </schema>
diff --git a/src/board-view-gtk.vala b/src/board-view-gtk.vala
index 2c16d6b..1673b02 100644
--- a/src/board-view-gtk.vala
+++ b/src/board-view-gtk.vala
@@ -8,10 +8,12 @@
  * license.
  */
 
-public class BoardViewGtk : Gtk.Grid, BoardView
+using Gtk;
+
+public class BoardViewGtk : Grid, BoardView
 {
     private PuzzleGenerator puzzle_generator;
-    private Gtk.ToggleButton[,] lights;
+    private ToggleButton[,] lights;
 
     public bool playable = true;
     private const int MIN_TOGGLE_SIZE = 48;
@@ -34,12 +36,12 @@ public class BoardViewGtk : Gtk.Grid, BoardView
         set_size_request (size * MIN_TOGGLE_SIZE, size * MIN_TOGGLE_SIZE);
 
         puzzle_generator = new PuzzleGenerator (size);
-        lights = new Gtk.ToggleButton [size, size];
-        List<Gtk.Widget> focus_list = new List<Gtk.Widget> ();
+        lights = new ToggleButton [size, size];
+        List<Widget> focus_list = new List<Widget> ();
         for (var x = 0; x < size; x++)
             for (var y = 0; y < size; y++)
             {
-                lights[x, y] = new Gtk.ToggleButton ();
+                lights[x, y] = new ToggleButton ();
                 lights[x, y].show ();
                 lights[x, y].toggled.connect (handle_toggle);
                 attach (lights[x, y], x, y, 1, 1);
@@ -61,7 +63,7 @@ public class BoardViewGtk : Gtk.Grid, BoardView
         if (!playable)
             return;
 
-        @foreach((light) => ((Gtk.ToggleButton)light).toggled.disconnect (handle_toggle));
+        @foreach((light) => ((ToggleButton)light).toggled.disconnect (handle_toggle));
 
         if (x>= size || y >= size || x < 0 || y < 0 )
             return;
@@ -77,7 +79,7 @@ public class BoardViewGtk : Gtk.Grid, BoardView
         if (!clicked)
             lights[(int) x, (int) y].set_active (!lights[(int) x, (int) y ].get_active ());
 
-        @foreach((light) => ((Gtk.ToggleButton)light).toggled.connect (handle_toggle));
+        @foreach((light) => ((ToggleButton)light).toggled.connect (handle_toggle));
     }
 
     public void clear_level ()
diff --git a/src/board-view.vala b/src/board-view.vala
index 2cd0bf2..4ae8b28 100644
--- a/src/board-view.vala
+++ b/src/board-view.vala
@@ -7,6 +7,7 @@
  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
  * license.
  */
+
 public interface BoardView: GLib.Object {
 
     public new const int size = 5;
diff --git a/src/game-view-gtk.vala b/src/game-view-gtk.vala
index 17babae..5844c32 100644
--- a/src/game-view-gtk.vala
+++ b/src/game-view-gtk.vala
@@ -1,4 +1,14 @@
-public class GtkGameView : Gtk.Stack, GameView {
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
+ * license.
+ */
+
+using Gtk;
+
+public class GtkGameView : Stack, GameView {
 
     private BoardViewGtk board_view;
     private int current_level;
@@ -10,22 +20,22 @@ public class GtkGameView : Gtk.Stack, GameView {
         switch (style)
         {
             case REFRESH:
-                transition_type = Gtk.StackTransitionType.SLIDE_DOWN;
+                transition_type = StackTransitionType.SLIDE_DOWN;
                 break;
             case SLIDE_NEXT:
             case SLIDE_FORWARD:
-                transition_type = Gtk.StackTransitionType.SLIDE_LEFT;
+                transition_type = StackTransitionType.SLIDE_LEFT;
                 break;
             case SLIDE_BACKWARD:
-                transition_type = Gtk.StackTransitionType.SLIDE_RIGHT;
+                transition_type = StackTransitionType.SLIDE_RIGHT;
                 break;
         }
 
         var new_level = "level %d".printf(current_level);
-        add_named ((Gtk.Widget)new_board, new_level);
-        set_visible_child ((Gtk.Widget)new_board);
+        add_named ((Widget)new_board, new_level);
+        set_visible_child ((Widget)new_board);
         ((BoardViewGtk)old_board).playable = false;
-        if (Gtk.Settings.get_for_screen (((Gtk.Widget)new_board).get_screen ()).gtk_enable_animations)
+        if (Gtk.Settings.get_for_screen (((Widget)new_board).get_screen ()).gtk_enable_animations)
             handlers.push_tail(notify["transition-running"].connect(() => board_replaced 
((BoardViewGtk)old_board, (BoardViewGtk)new_board)));
         else
             board_replaced ((BoardViewGtk)old_board, (BoardViewGtk)new_board);
diff --git a/src/game-view.vala b/src/game-view.vala
index 882f24d..00637ab 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -7,6 +7,7 @@
  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
  * license.
  */
+
 public interface GameView : GLib.Object {
 
     public enum ReplaceStyle {
diff --git a/src/lightsoff-window.vala b/src/lightsoff-window.vala
index 6be2bd7..e9c432f 100644
--- a/src/lightsoff-window.vala
+++ b/src/lightsoff-window.vala
@@ -87,13 +87,14 @@ public class LightsoffWindow : ApplicationWindow
 
     private void update_title (int level)
     {
-        /* The title of the window, %d is the level number */
+        /* Translators: the title of the window, %d is the level number */
         headerbar.title = _("Puzzle %d").printf (level);
 
-        /* Subtitle is a game hint when playing level one, the number of moves otherwise */
         if (level == 1)
+            /* Translators: default subtitle, only displayed when playing level one; used as a game hint */
             headerbar.subtitle = _("Turn off all the lights!");
         else
+            /* else show number of moves */
             update_subtitle (0);
     }
 
diff --git a/src/lightsoff.vala b/src/lightsoff.vala
index fed5e73..1a1546e 100644
--- a/src/lightsoff.vala
+++ b/src/lightsoff.vala
@@ -10,8 +10,13 @@
  * license.
  */
 
+using Gtk;
+
 private class LightsOff : Gtk.Application
 {
+    /* Translators: name of the program, as seen in the headerbar, in GNOME Shell, or in the about dialog */
+    private const string PROGRAM_NAME = _("Lights Off");
+
     private LightsoffWindow window;
 
     private static string? [] remaining = new string? [1];
@@ -38,8 +43,8 @@ private class LightsOff : Gtk.Application
         Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
         Intl.textdomain (Config.GETTEXT_PACKAGE);
 
-        Environment.set_application_name (_("Lights Off"));
-        Gtk.Window.set_default_icon_name ("org.gnome.LightsOff");
+        Environment.set_application_name (PROGRAM_NAME);
+        Window.set_default_icon_name ("org.gnome.LightsOff");
 
         var app = new LightsOff ();
         return app.run (args);
@@ -57,8 +62,7 @@ private class LightsOff : Gtk.Application
         if (options.contains ("version")
          || remaining [0] != null && (!) remaining [0] == "version")
         {
-            /* Translators: name of the program, as displayed in the output of the command-line 'lightsoff 
--version' */
-            print ("%s %s\n", _("Lights Off"), Config.VERSION);    // TODO is usually not translated, for 
parsing... would be better?
+            print ("%s %s\n", PROGRAM_NAME, Config.VERSION);   // TODO is usually not translated, for 
parsing... would be better?
             return Posix.EXIT_SUCCESS;
         }
 
@@ -103,7 +107,7 @@ private class LightsOff : Gtk.Application
     {
         try
         {
-            Gtk.show_uri (window.get_screen (), "help:lightsoff", Gtk.get_current_event_time ());
+            show_uri (window.get_screen (), "help:lightsoff", get_current_event_time ());
         }
         catch (Error e)
         {
@@ -116,7 +120,6 @@ private class LightsOff : Gtk.Application
         window.destroy ();
     }
 
-
     private void about_cb ()
     {
         string[] authors =
@@ -137,18 +140,26 @@ private class LightsOff : Gtk.Application
             "Eric Baudais"
         };
 
-        Gtk.show_about_dialog (window,
-                               "program-name", _("Lights Off"),
-                               "version", Config.VERSION,
-                               "comments",
-                               _("Turn off all the lights"),
-                               "copyright", "Copyright © 2009 Tim Horton",
-                               "license-type", Gtk.License.GPL_2_0,
-                               "authors", authors,
-                               "artists", artists,
-                               "documenters", documenters,
-                               "translator-credits", _("translator-credits"),
-                               "logo-icon-name", "org.gnome.LightsOff",
-                               "website", "https://wiki.gnome.org/Apps/Lightsoff";);
+        /* Translators: short description of the application, seen in the About dialog */
+        string comments = _("Turn off all the lights");
+
+
+        /* Translators: about dialog text; label of the website link */
+        string website_label = _("Page on GNOME wiki");
+
+        show_about_dialog (window,
+                           "program-name",          PROGRAM_NAME,
+                           "version",               Config.VERSION,
+                           "comments",              comments,
+                           "copyright",             "Copyright © 2009 Tim Horton",  // TODO _("Copyright 
\xc2\xa9 %u-%u – Arnaud Bonatti").printf (20xx, 20xx)
+                           "license-type",          License.GPL_2_0,
+                           "authors",               authors,
+                           "artists",               artists,
+                           "documenters",           documenters,
+        /* Translators: about dialog text; this string should be replaced by a text crediting yourselves and 
your translation team, or should be left empty. Do not translate literally! */
+                           "translator-credits",    _("translator-credits"),
+                           "logo-icon-name",        "org.gnome.LightsOff",
+                           "website",               "https://wiki.gnome.org/Apps/Lightsoff";,
+                           "website-label",         website_label);
     }
 }


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