[json-glib] Add i18n machinery
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [json-glib] Add i18n machinery
- Date: Wed, 1 Jun 2011 12:35:28 +0000 (UTC)
commit 67edce08670ce1da4956f87948985434ac5ae2ca
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Wed Jun 1 13:09:01 2011 +0100
Add i18n machinery
We need to translate the GError messages.
.gitignore | 2 ++
Makefile.am | 2 +-
build/autotools/Makefile.am | 1 +
build/autotools/as-linguas.m4 | 24 ++++++++++++++++++++++++
configure.ac | 12 ++++++++++++
json-glib/json-gobject.c | 2 ++
json-glib/json-gvariant.c | 6 ++++++
json-glib/json-parser.c | 2 ++
json-glib/json-path.c | 4 +++-
json-glib/json-reader.c | 2 ++
po/.gitignore | 13 +++++++++++++
po/Makevars | 7 +++++++
po/POTFILES.in | 6 ++++++
13 files changed, 81 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index feddaff..4ad056f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+ABOUT-NLS
INSTALL
Makefile
Makefile.in
@@ -14,6 +15,7 @@ config.h
config.h.in
config.h.in~
config.log
+config.rpath
config.status
config.sub
depcomp
diff --git a/Makefile.am b/Makefile.am
index 579d5e4..3bbeefa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
ACLOCAL_AMFLAGS = -I build/autotools
-SUBDIRS = json-glib doc build
+SUBDIRS = json-glib doc build po
pcfiles = json-glib-1.0.pc
diff --git a/build/autotools/Makefile.am b/build/autotools/Makefile.am
index 3780f36..cc2d11c 100644
--- a/build/autotools/Makefile.am
+++ b/build/autotools/Makefile.am
@@ -1,5 +1,6 @@
EXTRA_DIST = \
as-compiler-flag.m4 \
+ as-linguas.m4 \
introspection.m4 \
Makefile.am.silent \
Makefile.am.enums \
diff --git a/build/autotools/as-linguas.m4 b/build/autotools/as-linguas.m4
new file mode 100644
index 0000000..92b28f7
--- /dev/null
+++ b/build/autotools/as-linguas.m4
@@ -0,0 +1,24 @@
+# Set ALL_ALL_LINGUAS based on the .po files present. Optional argument is the
+# name of the po directory. $podir/LINGUAS.ignore can be used to ignore a
+# subset of the po files.
+
+AC_DEFUN([AS_ALL_LINGUAS],
+[
+ AC_MSG_CHECKING([for linguas])
+ podir="m4_default([$1],[$srcdir/po])"
+ linguas=`cd $podir && ls *.po 2>/dev/null | awk 'BEGIN { FS="."; ORS=" " } { print $[]1 }'`
+ if test -f "$podir/LINGUAS.ignore"; then
+ ALL_LINGUAS="";
+ ignore_linguas=`sed -n -e 's/^\s\+\|\s\+$//g' -e '/^#/b' -e '/\S/!b' \
+ -e 's/\s\+/\n/g' -e p "$podir/LINGUAS.ignore"`;
+ for lang in $linguas; do
+ if ! echo "$ignore_linguas" | grep -q "^${lang}$"; then
+ ALL_LINGUAS="$ALL_LINGUAS $lang";
+ fi;
+ done;
+ else
+ ALL_LINGUAS="$linguas";
+ fi;
+ AC_SUBST([ALL_LINGUAS])
+ AC_MSG_RESULT($ALL_LINGUAS)
+])
diff --git a/configure.ac b/configure.ac
index 61e4cd8..fa17e28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,6 +166,16 @@ GTK_DOC_CHECK([1.13], [--flavour no-tmpl])
GOBJECT_INTROSPECTION_CHECK([0.9.5])
+AM_GNU_GETTEXT_VERSION([0.18])
+AM_GNU_GETTEXT([external])
+
+GETTEXT_PACKAGE="json-glib-1.0"
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
+ ["$GETTEXT_PACKAGE"],
+ [The prefix for our gettext translation domains.])
+AS_ALL_LINGUAS
+
AC_CONFIG_FILES([
Makefile
@@ -184,6 +194,8 @@ AC_CONFIG_FILES([
doc/reference/Makefile
doc/reference/version.xml
+ po/Makefile.in
+
json-glib.pc
])
diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c
index fbc6efc..d6e0045 100644
--- a/json-glib/json-gobject.c
+++ b/json-glib/json-gobject.c
@@ -39,6 +39,8 @@
#include <string.h>
#include <stdlib.h>
+#include <glib/gi18n-lib.h>
+
#include "json-types-private.h"
#include "json-gobject-private.h"
diff --git a/json-glib/json-gvariant.c b/json-glib/json-gvariant.c
index 276b871..6eaaa78 100644
--- a/json-glib/json-gvariant.c
+++ b/json-glib/json-gvariant.c
@@ -17,10 +17,16 @@
* Eduardo Lima Mitev <elima igalia com>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <glib/gi18n-lib.h>
+
#include "json-gvariant.h"
/**
diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c
index ae5e48a..4a05d62 100644
--- a/json-glib/json-parser.c
+++ b/json-glib/json-parser.c
@@ -36,6 +36,8 @@
#include <string.h>
+#include <glib/gi18n-lib.h>
+
#include "json-types-private.h"
#include "json-debug.h"
diff --git a/json-glib/json-path.c b/json-glib/json-path.c
index 0857e05..4ed232f 100644
--- a/json-glib/json-path.c
+++ b/json-glib/json-path.c
@@ -200,12 +200,14 @@
* #JsonPath is available since JSON-GLib 0.14
*/
-#ifndef HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
+#include <glib/gi18n-lib.h>
+
#include "json-path.h"
#include "json-debug.h"
diff --git a/json-glib/json-reader.c b/json-glib/json-reader.c
index 4aaadbe..fd0a521 100644
--- a/json-glib/json-reader.c
+++ b/json-glib/json-reader.c
@@ -70,6 +70,8 @@
#include <string.h>
+#include <glib/gi18n-lib.h>
+
#include "json-reader.h"
#include "json-types-private.h"
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 0000000..527ad63
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,13 @@
+/Makefile.in.in
+/Makevars.template
+/POTFILES
+/Rules-quot
+/boldquot.sed
+/en boldquot header
+/en quot header
+/insert-header.sin
+/quot.sed
+/remove-potcdate.sed
+/remove-potcdate.sin
+*.gmo
+*.pot
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..0df7a65
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,7 @@
+DOMAIN = json-glib-1.0
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=P_ --keyword=C_
+COPYRIGHT_HOLDER = Intel Corporation
+MSGID_BUGS_ADDRESS = http://bugzilla.gnome.org/enter_bug.cgi?product=json-glib
+EXTRA_LOCALE_CATEGORIES =
+
+top_builddir = ..
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..6d67667
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,6 @@
+# keep sorted alphabetically!
+json-glib/json-gobject.c
+json-glib/json-gvariant.c
+json-glib/json-parser.c
+json-glib/json-path.c
+json-glib/json-reader.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]