[goffice] Make GODirection nick names localizable since they are used in a gnumeric dialog.



commit 4d3247f36dfc8b8ebbf63b8eb7a242d2d0569d85
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Apr 16 16:43:27 2011 +0200

    Make GODirection nick names localizable since they are used in a gnumeric dialog.

 ChangeLog                   |    7 +++++++
 goffice/utils/go-geometry.c |   28 +++++++++++++++++++---------
 goffice/utils/go-geometry.h |    1 +
 po/ChangeLog                |    6 ++++++
 po/POTFILES.in              |    2 ++
 5 files changed, 35 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cc9b8fe..8875851 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-16  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/utils/go-geometry.c (go_direction_get_type),
+	(go_direction_get_name): make nick names localizable since they are
+	used in a gnumeric dialog.
+	* goffice/utils/go-geometry.h: ditto.
+
 2011-04-10  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/graph/gog-legend.c (cb_render_elements): fix legends for plots
diff --git a/goffice/utils/go-geometry.c b/goffice/utils/go-geometry.c
index 1f1239a..1b75982 100644
--- a/goffice/utils/go-geometry.c
+++ b/goffice/utils/go-geometry.c
@@ -24,6 +24,8 @@
 #include <goffice/math/go-math.h>
 #include <goffice/utils/go-geometry.h>
 
+#include <glib/gi18n-lib.h>
+
 #define dist(x0, y0, x1, y1) hypot((x0) - (x1),(y0) - (y1))
 
 /**
@@ -290,20 +292,28 @@ go_direction_is_forward (GODirection d)
 	return (d & 1) != 0;
 }
 
+static GEnumValue const directions[] = {
+	{ GO_DIRECTION_NONE,	"GO_DIRECTION_NONE",	N_("none") },
+	{ GO_DIRECTION_DOWN,	"GO_DIRECTION_DOWN",	N_("down") },
+	{ GO_DIRECTION_UP,	"GO_DIRECTION_UP",	N_("up") },
+	{ GO_DIRECTION_RIGHT,	"GO_DIRECTION_RIGHT",	N_("right") },
+	{ GO_DIRECTION_LEFT,	"GO_DIRECTION_LEFT",	N_("left") },
+	{ 0, NULL, NULL }
+};
+
 GType
 go_direction_get_type (void)
 {
 	static GType etype = 0;
 	if (etype == 0) {
-		static GEnumValue const values[] = {
-			{ GO_DIRECTION_NONE,	"GO_DIRECTION_NONE",	"none" },
-			{ GO_DIRECTION_DOWN,	"GO_DIRECTION_DOWN",	"down" },
-			{ GO_DIRECTION_UP,	"GO_DIRECTION_UP",	"up" },
-			{ GO_DIRECTION_RIGHT,	"GO_DIRECTION_RIGHT",	"right" },
-			{ GO_DIRECTION_LEFT,	"GO_DIRECTION_LEFT",	"left" },
-			{ 0, NULL, NULL }
-		};
-		etype = g_enum_register_static (g_intern_static_string ("GODirection"), values);
+		etype = g_enum_register_static (g_intern_static_string ("GODirection"), directions);
 	}
 	return etype;
 }
+
+char const *
+go_direction_get_name (GODirection d)
+{
+	g_return_val_if_fail (d < G_N_ELEMENTS (directions), NULL);
+	return _(directions[d].value_nick);
+}
diff --git a/goffice/utils/go-geometry.h b/goffice/utils/go-geometry.h
index 3a44490..f062cc4 100644
--- a/goffice/utils/go-geometry.h
+++ b/goffice/utils/go-geometry.h
@@ -78,6 +78,7 @@ GOGeometrySide		go_geometry_calc_label_position	(GOGeometryOBR *obr, double alph
 GType    go_direction_get_type	    (void) G_GNUC_CONST;
 gboolean go_direction_is_horizontal (GODirection d);
 gboolean go_direction_is_forward    (GODirection d);
+char const *go_direction_get_name   (GODirection d);
 
 G_END_DECLS
 
diff --git a/po/ChangeLog b/po/ChangeLog
index 83e628a..d4b3bec 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-16  Jean Brefort  <jean brefort normalesup org>
+
+	reviewed by: <delete if not using a buddy>
+
+	* POTFILES.in:
+
 2011-04-13  Jean Brefort  <jean brefort normalesup org>
 
 	* POTFILES.in: updated files list.
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0d7186c..d11855f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -225,6 +225,8 @@ goffice/utils/go-font.c
 goffice/utils/go-font.h
 goffice/utils/go-format.c
 goffice/utils/go-format.h
+goffice/utils/go-geometry.c
+goffice/utils/go-geometry.h
 goffice/utils/go-glib-extras.c
 goffice/utils/go-glib-extras.h
 goffice/utils/go-gradient.c



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