[gnome-builder] helpers: add ide_gettext() helper
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] helpers: add ide_gettext() helper
- Date: Tue, 11 Oct 2016 22:25:40 +0000 (UTC)
commit cef340c4cb4f8dcaa72eef00583e9477e6aef976
Author: Christian Hergert <chergert redhat com>
Date: Tue Oct 11 15:22:00 2016 -0700
helpers: add ide_gettext() helper
This can be used by plugins to reuse our gettext layer from
C rather than duplicating effort for translation domains in
the plugin layer.
https://bugzilla.gnome.org/show_bug.cgi?id=772733
libide/util/ide-glib.c | 10 ++++++++++
libide/util/ide-glib.h | 19 ++++++++++---------
2 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/libide/util/ide-glib.c b/libide/util/ide-glib.c
index 5599a90..0bfe8a3 100644
--- a/libide/util/ide-glib.c
+++ b/libide/util/ide-glib.c
@@ -18,6 +18,8 @@
#define G_LOG_DOMAIN "ide-glib"
+#include "config.h"
+
#include "ide-glib.h"
typedef struct
@@ -171,3 +173,11 @@ ide_g_task_return_error_from_main (GTask *task,
task_state_attach (state);
}
+
+const gchar *
+ide_gettext (const gchar *message)
+{
+ if (message != NULL)
+ return g_dgettext (GETTEXT_PACKAGE, message);
+ return NULL;
+}
diff --git a/libide/util/ide-glib.h b/libide/util/ide-glib.h
index 971bb18..1895dd6 100644
--- a/libide/util/ide-glib.h
+++ b/libide/util/ide-glib.h
@@ -23,15 +23,16 @@
G_BEGIN_DECLS
-void ide_g_task_return_boolean_from_main (GTask *task,
- gboolean value);
-void ide_g_task_return_int_from_main (GTask *task,
- gint value);
-void ide_g_task_return_pointer_from_main (GTask *task,
- gpointer value,
- GDestroyNotify notify);
-void ide_g_task_return_error_from_main (GTask *task,
- GError *error);
+const gchar *ide_gettext (const gchar *message);
+void ide_g_task_return_boolean_from_main (GTask *task,
+ gboolean value);
+void ide_g_task_return_int_from_main (GTask *task,
+ gint value);
+void ide_g_task_return_pointer_from_main (GTask *task,
+ gpointer value,
+ GDestroyNotify notify);
+void ide_g_task_return_error_from_main (GTask *task,
+ GError *error);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]