[gnome-clocks] Cleaner gettext approach, some new strings marked as translatable



commit c7eebd639728eca22ea7f54844ea870b5ca69807
Author: MaÃl Lavault <mael lavault mailz org>
Date:   Thu Aug 16 16:30:48 2012 +0200

    Cleaner gettext approach, some new strings marked as translatable
    
    Signed-off-by: MaÃl Lavault <mael lavault mailz org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681019

 gnome-clocks           |    1 +
 gnomeclocks/app.py     |    4 +---
 gnomeclocks/clocks.py  |    2 --
 gnomeclocks/timer.py   |    2 --
 gnomeclocks/widgets.py |   26 ++++++++++++--------------
 5 files changed, 14 insertions(+), 21 deletions(-)
---
diff --git a/gnome-clocks b/gnome-clocks
index 260c020..095d03b 100755
--- a/gnome-clocks
+++ b/gnome-clocks
@@ -51,6 +51,7 @@ locale_domain = "gnome-clocks"
 locale.setlocale(locale.LC_ALL,'')
 gettext.bindtextdomain(locale_domain, Dirs.get_locale_dir ())
 gettext.textdomain(locale_domain)
+gettext.install(locale_domain, Dirs.get_locale_dir ())
 
 from gnomeclocks.app import ClocksApplication
 
diff --git a/gnomeclocks/app.py b/gnomeclocks/app.py
index b2c35ba..baba7ba 100644
--- a/gnomeclocks/app.py
+++ b/gnomeclocks/app.py
@@ -20,8 +20,6 @@
 
 import os
 
-from gettext import gettext as _
-
 from gi.repository import Gtk, Gdk, GObject, Gio
 
 from clocks import World, Alarm, Timer, Stopwatch
@@ -157,7 +155,7 @@ class ClocksToolbar(Gtk.Toolbar):
 
         self.newButton = Gtk.Button()
 
-        label = Gtk.Label("  New  ")
+        label = Gtk.Label(_("  New  "))
         self.newButton.get_style_context().add_class('raised')
         self.newButton.add(label)
 
diff --git a/gnomeclocks/clocks.py b/gnomeclocks/clocks.py
index 4598c09..5da0d1f 100644
--- a/gnomeclocks/clocks.py
+++ b/gnomeclocks/clocks.py
@@ -18,8 +18,6 @@
  Author: Seif Lotfy <seif lotfy collabora co uk>
 """
 
-from gettext import gettext as _
-
 from gi.repository import Gtk, GObject, Gio, Gdk, Gst, Notify, cairo
 from gi.repository.GdkPixbuf import Pixbuf
 
diff --git a/gnomeclocks/timer.py b/gnomeclocks/timer.py
index 69157f5..3a1f3e3 100644
--- a/gnomeclocks/timer.py
+++ b/gnomeclocks/timer.py
@@ -17,8 +17,6 @@
  Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 """
 
-from gettext import gettext as _
-
 from gi.repository import Gtk, Gio, Gdk
 
 TIMER = "<span font_desc=\"64.0\">%02i</span>"
diff --git a/gnomeclocks/widgets.py b/gnomeclocks/widgets.py
index f0f8679..51257f0 100644
--- a/gnomeclocks/widgets.py
+++ b/gnomeclocks/widgets.py
@@ -18,8 +18,6 @@
  Author: Seif Lotfy <seif lotfy collabora co uk>
 """
 
-from gettext import gettext as _
-
 from gi.repository import Gtk, Gdk, GdkPixbuf, GObject, Gio, PangoCairo, Pango, GWeather
 
 from storage import Location
@@ -352,7 +350,7 @@ class NewAlarmDialog (Gtk.Dialog):
                     None, (GObject.TYPE_PYOBJECT,))}
 
     def __init__(self, parent):
-        Gtk.Dialog.__init__(self, "New Alarm", parent)
+        Gtk.Dialog.__init__(self, _("New Alarm"), parent)
         self.set_border_width (12)
         self.parent = parent
         self.set_transient_for(parent)
@@ -368,7 +366,7 @@ class NewAlarmDialog (Gtk.Dialog):
         table1.set_col_spacings(9)
         content_area = self.get_content_area ()
         content_area.pack_start(table1, True, True, 0)
-        self.add_buttons("Cancel", 0, "Save", 1)
+        self.add_buttons(_("Cancel"), 0, _("Save"), 1)
         self.connect("response", self.on_response)
         table1.set_border_width (5)
 
@@ -376,7 +374,7 @@ class NewAlarmDialog (Gtk.Dialog):
         h = t.tm_hour
         m = t.tm_min
         p = time.strftime("%p", t)
-        time_label = Gtk.Label ("Time")
+        time_label = Gtk.Label (_("Time"))
         time_label.set_alignment(1.0, 0.5)
         points = Gtk.Label (":")
         points.set_alignment(0.5, 0.5)
@@ -430,19 +428,19 @@ class NewAlarmDialog (Gtk.Dialog):
         else:
             table1.attach(entry, 1, 4, 1, 2)
 
-        buttond1 = Gtk.ToggleButton(label="Mon")
+        buttond1 = Gtk.ToggleButton(label=_("Mon"))
         buttond1.connect("clicked", self.on_d1_clicked)
-        buttond2 = Gtk.ToggleButton(label="Tue")
+        buttond2 = Gtk.ToggleButton(label=_("Tue"))
         buttond2.connect("clicked", self.on_d2_clicked)
-        buttond3 = Gtk.ToggleButton(label="Wed")
+        buttond3 = Gtk.ToggleButton(label=_("Wed"))
         buttond3.connect("clicked", self.on_d3_clicked)
-        buttond4 = Gtk.ToggleButton(label="Thu")
+        buttond4 = Gtk.ToggleButton(label=_("Thu"))
         buttond4.connect("clicked", self.on_d4_clicked)
-        buttond5 = Gtk.ToggleButton(label="Fri")
+        buttond5 = Gtk.ToggleButton(label=_("Fri"))
         buttond5.connect("clicked", self.on_d5_clicked)
-        buttond6 = Gtk.ToggleButton(label="Sat")
+        buttond6 = Gtk.ToggleButton(label=_("Sat"))
         buttond6.connect("clicked", self.on_d6_clicked)
-        buttond7 = Gtk.ToggleButton(label="Sun")
+        buttond7 = Gtk.ToggleButton(label=_("Sun"))
         buttond7.connect("clicked", self.on_d7_clicked)
 
         # create a box and put them all in it
@@ -600,7 +598,7 @@ class WorldEmpty(Gtk.Box):
         image = Gtk.Image.new_from_gicon(gicon, Gtk.IconSize.DIALOG)
         image.set_sensitive (False)
         text = Gtk.Label("")
-        text.set_markup("<span color='darkgrey'>Select <b>New</b> to add a world clock</span>")
+        text.set_markup("<span color='darkgrey'>" + _("Select <b>New</b> to add a world clock") + "</span>")
         self.pack_start(Gtk.Label(""), True, True, 0)
         self.pack_start(image, False, False, 6)
         self.pack_start(text, False, False, 6)
@@ -619,7 +617,7 @@ class AlarmsEmpty(Gtk.Box):
         image = Gtk.Image.new_from_gicon(gicon, Gtk.IconSize.DIALOG)
         image.set_sensitive (False)
         text = Gtk.Label("")
-        text.set_markup("<span color='darkgrey'>Select <b>New</b> to add a world clock</span>")
+        text.set_markup("<span color='darkgrey'>" + _("Select <b>New</b> to add a world clock") + "</span>")
         self.pack_start(Gtk.Label(""), True, True, 0)
         self.pack_start(image, False, False, 6)
         self.pack_start(text, False, False, 6)



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