[gnome-control-center/wip/datetime-redesign: 13/13] datetime: Mark the time format strings as translatable



commit 7c1005d94a319f213e1e4d5863b0d584da6a3cdd
Author: Kalev Lember <kalevlember gmail com>
Date:   Tue Sep 3 21:12:38 2013 +0200

    datetime: Mark the time format strings as translatable
    
    ... and add translator comments explainings what they do. The RTL
    languages are likely going to want to show them in a different order.
    
    We should eventually move to just using GnomeWallClock and/or
    g_date_time_format with %c that already have translated the time format
    strings. However, in case this doesn't make it in 3.10, mark the
    current strings in g-c-c as translatable to get some translation
    coverage.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694985

 panels/datetime/cc-datetime-panel.c |   25 ++++++++++++++++++++-----
 po/POTFILES.in                      |    1 +
 2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index f053991..9452a86 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -36,6 +36,7 @@
 #include <stdlib.h>
 #include <libintl.h>
 
+#include <glib/gi18n.h>
 #include <libgnome-desktop/gnome-languages.h>
 #include <libgnome-desktop/gnome-wall-clock.h>
 #include <polkit/polkit.h>
@@ -314,9 +315,15 @@ update_time (CcDateTimePanel *self)
 
   /* Update the time on the listbow row */
   if (use_ampm)
-    label = g_date_time_format (priv->date, "%e %B %Y, %l:%M %p");
+    {
+      /* Translators: This is the time format used in 12-hour mode. */
+      label = g_date_time_format (priv->date, _("%e %B %Y, %l:%M %p"));
+    }
   else
-    label = g_date_time_format (priv->date, "%e %B %Y, %R");
+    {
+      /* Translators: This is the time format used in 24-hour mode. */
+      label = g_date_time_format (priv->date, _("%e %B %Y, %R"));
+    }
 
   gtk_label_set_text (GTK_LABEL (W ("datetime_label")), label);
   g_free (label);
@@ -517,12 +524,20 @@ update_timezone (CcDateTimePanel *self)
           gtk_label_set_text (GTK_LABEL (W ("timezone_label")), label);
           g_free (label);
 
-          utc_label = g_date_time_format (priv->date, "UTC%z");
+          /* Translators: UTC here means the Coordinated Universal Time.
+           * %z will be replaced by the offset from UTC e.g. UTC+0200 */
+          utc_label = g_date_time_format (priv->date, _("UTC%z"));
 
           if (use_ampm)
-            time_label = g_date_time_format (priv->date, "%l:%M %p");
+            {
+              /* Translators: This is the time format used in 24-hour mode. */
+              time_label = g_date_time_format (priv->date, _("%l:%M %p"));
+            }
           else
-            time_label = g_date_time_format (priv->date, "%R");
+            {
+              /* Translators: This is the time format used for AM/PM. */
+              time_label = g_date_time_format (priv->date, _("%R"));
+            }
 
           /* Update the text bubble in the timezone map */
           bubble_text = g_strdup_printf ("<b>%s (%s)</b>\n"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 29df4d4..835c571 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -22,6 +22,7 @@ panels/common/cc-common-language.c
 panels/common/cc-language-chooser.c
 panels/common/cc-util.c
 [type: gettext/glade]panels/common/language-chooser.ui
+panels/datetime/cc-datetime-panel.c
 [type: gettext/glade]panels/datetime/datetime.ui
 panels/datetime/gnome-datetime-panel.desktop.in.in
 panels/datetime/org.gnome.controlcenter.datetime.policy.in


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