libgweather r621 - in trunk: . libgweather po



Author: vuntz
Date: Tue Feb 17 19:08:48 2009
New Revision: 621
URL: http://svn.gnome.org/viewvc/libgweather?rev=621&view=rev

Log:
2009-02-17  Vincent Untz  <vuntz gnome org>

	* POTFILES.in: updated

2009-02-17  Vincent Untz  <vuntz gnome org>

	* libgweather/timezone-menu.c: (gweather_timezone_model_new): mark
	Unknown for translation, with context.
	* libgweather/weather-priv.h: add C_() (and gweather_dpgettext())
	* libgweather/weather.c: (gweather_gettext_init): new inline function,
	based on code from gweather_gettext()
	(gweather_gettext): use gweather_gettext_init()
	(gweather_dpgettext): create


Modified:
   trunk/ChangeLog
   trunk/libgweather/timezone-menu.c
   trunk/libgweather/weather-priv.h
   trunk/libgweather/weather.c
   trunk/po/ChangeLog
   trunk/po/POTFILES.in

Modified: trunk/libgweather/timezone-menu.c
==============================================================================
--- trunk/libgweather/timezone-menu.c	(original)
+++ trunk/libgweather/timezone-menu.c	Tue Feb 17 19:08:48 2009
@@ -24,6 +24,7 @@
 
 #define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
 #include "timezone-menu.h"
+#include "weather-priv.h"
 
 #include <string.h>
 
@@ -269,17 +270,22 @@
     GtkTreeStore *store;
     GtkTreeModel *model;
     GtkTreeIter iter;
+    char *unknown;
 
     store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
     model = GTK_TREE_MODEL (store);
 
+    unknown = g_markup_printf_escaped ("<i>%s</i>", C_("timezone", "Unknown"));
+
     gtk_tree_store_append (store, &iter, NULL);
     gtk_tree_store_set (store, &iter,
-			GWEATHER_TIMEZONE_MENU_NAME, "<i>Unknown</i>",
+			GWEATHER_TIMEZONE_MENU_NAME, unknown,
 			GWEATHER_TIMEZONE_MENU_ZONE, NULL,
 			-1);
     gtk_tree_store_append (store, &iter, NULL);
 
+    g_free (unknown);
+
     insert_locations (store, top);
 
     return model;

Modified: trunk/libgweather/weather-priv.h
==============================================================================
--- trunk/libgweather/weather-priv.h	(original)
+++ trunk/libgweather/weather-priv.h	Tue Feb 17 19:08:48 2009
@@ -34,7 +34,9 @@
 #include "gweather-location.h"
 
 const char *gweather_gettext (const char *str) G_GNUC_FORMAT (1);
+const char *gweather_dpgettext (const char *context, const char *str) G_GNUC_FORMAT (2);
 #define _(str) (gweather_gettext (str))
+#define C_(context, str) (gweather_dpgettext (context, str))
 #define N_(str) (str)
 
 

Modified: trunk/libgweather/weather.c
==============================================================================
--- trunk/libgweather/weather.c	(original)
+++ trunk/libgweather/weather.c	Tue Feb 17 19:08:48 2009
@@ -47,22 +47,36 @@
 
 static void _weather_internal_check (void);
 
-const char *
-gweather_gettext (const char *str)
+
+static inline void
+gweather_gettext_init (void)
 {
     static gsize gweather_gettext_initialized = FALSE;
 
     if (G_UNLIKELY (g_once_init_enter (&gweather_gettext_initialized))) {
-	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+        bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 #ifdef HAVE_BIND_TEXTDOMAIN_CODESET
-	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 #endif
-	g_once_init_leave (&gweather_gettext_initialized, TRUE);
+        g_once_init_leave (&gweather_gettext_initialized, TRUE);
     }
+}
 
+const char *
+gweather_gettext (const char *str)
+{
+    gweather_gettext_init ();
     return dgettext (GETTEXT_PACKAGE, str);
 }
 
+const char *
+gweather_dpgettext (const char *context,
+                    const char *str)
+{
+    gweather_gettext_init ();
+    return g_dpgettext2 (GETTEXT_PACKAGE, context, str);
+}
+
 /*
  * Convert string of the form "DD-MM-SSH" to radians
  * DD:degrees (to 3 digits), MM:minutes, SS:seconds H:hemisphere (NESW)

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Tue Feb 17 19:08:48 2009
@@ -5,6 +5,7 @@
 libgweather/gweather-gconf.c
 libgweather/gweather-prefs.c
 libgweather/gweather.schemas.in
+libgweather/timezone-menu.c
 libgweather/weather-iwin.c
 libgweather/weather-metar.c
 libgweather/weather-wx.c



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