[gnome-builder] i18n: add basic i18n/l10n plumbing for translators



commit 22947800d82b976304981f1fbe5ceb43811bfc36
Author: Christian Hergert <christian hergert me>
Date:   Tue Jan 20 20:16:13 2015 -0800

    i18n: add basic i18n/l10n plumbing for translators
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743253

 autogen.sh           |    1 +
 configure.ac         |    9 +++++++++
 po/.gitignore        |    3 +++
 src/gnome-builder.mk |    3 ++-
 src/main.c           |   13 ++++++++++++-
 5 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index a3262f9..90913b8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -31,6 +31,7 @@ for group in ac am config lt output print; do
 done
 
 # Run autoconf to build configure.
+intltoolize --automake
 autoreconf --force --install --verbose -I build/autotools ${ACLOCAL_FLAGS} || exit $?
 
 # Remove that pesky autom4te.cache
diff --git a/configure.ac b/configure.ac
index 1586b3a..bc00594 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,14 @@ AC_SUBST(ACLOCAL_AMFLAGS, "-I build/autotools")
 AC_CONFIG_HEADERS([config.h])
 m4_include([build/autotools/autoconf.d/post-ac.m4])
 
+# Initialize gettext
+IT_PROG_INTLTOOL([0.50.1])
+GETTEXT_PACKAGE=AC_PACKAGE_TARNAME
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
+                   [GETTEXT package name])
+AM_GLIB_GNU_GETTEXT
+
 # Initlize libtool and things that go with it.
 m4_include([build/autotools/autoconf.d/pre-lt.m4])
 m4_include([build/autotools/autoconf.d/setup_libtool.m4])
@@ -52,6 +60,7 @@ AC_CONFIG_FILES([
        data/org.gnome.builder.editor.gschema.xml
        data/org.gnome.builder.editor.language.gschema.xml
        data/org.gnome.builder.editor.vim.gschema.xml
+       po/Makefile.in
 ])
 
 # Last change to configure things and write configuration files.
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 0000000..85bf2f1
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,3 @@
+Makefile.in.in
+POTFILES
+stamp-it
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 0000000..e69de29
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..e69de29
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644
index 0000000..e69de29
diff --git a/src/gnome-builder.mk b/src/gnome-builder.mk
index 6f46bc8..60d1172 100644
--- a/src/gnome-builder.mk
+++ b/src/gnome-builder.mk
@@ -221,7 +221,8 @@ libgnome_builder_la_LIBADD = \
        -lm
 
 libgnome_builder_la_CFLAGS = \
-       -DPACKAGE_DATADIR="\"$(datadir)\"" \
+       -DPACKAGE_DATADIR="\"${datadir}\"" \
+       -DPACKAGE_LOCALE_DIR=\""${datadir}/locale"\" \
        $(BUILDER_CFLAGS) \
        $(MAINTAINER_CFLAGS) \
        -I$(top_builddir)/src/util \
diff --git a/src/main.c b/src/main.c
index 47afad7..dfc9a4f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -18,10 +18,15 @@
 
 #define G_LOG_DOMAIN "Builder"
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <libgit2-glib/ggit.h>
+#include <locale.h>
 
 #include "gb-application.h"
 #include "gb-log.h"
@@ -33,7 +38,13 @@ main (int   argc,
   GApplication *app;
   int ret;
 
-  g_set_prgname ("gnome-builder");
+  setlocale (LC_ALL, "");
+
+  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  textdomain (GETTEXT_PACKAGE);
+
+  g_set_prgname (PACKAGE_TARNAME);
   g_set_application_name (_("Builder"));
 
   gb_log_init (TRUE, NULL);


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