[dconf] Enable i18n support for dconf-editor



commit c8672ee78d7258af57e36664419877c6799ab69c
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Aug 6 13:20:44 2012 -0400

    Enable i18n support for dconf-editor
    
    Add i18n support using intltool and glib-gettext (to avoid the
    well-known issues with vanilla gettext).
    
    This patch is heavily based on a patch by Gabor Kelemen.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642217

 Makefile.am                                        |    2 +-
 autogen.sh                                         |    1 +
 configure.ac                                       |   11 ++++++++++-
 editor/.gitignore                                  |    1 +
 editor/Makefile.am                                 |    4 +++-
 editor/ca.desrt.dconf-editor.gschema.xml           |    2 +-
 editor/config.vapi                                 |    1 +
 ...ditor.desktop.in => dconf-editor.desktop.in.in} |    4 ++--
 editor/dconf-editor.vala                           |    5 +++++
 po/.gitignore                                      |    5 +++++
 po/POTFILES.in                                     |    9 +++++++++
 po/POTFILES.skip                                   |    3 +++
 12 files changed, 42 insertions(+), 6 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index affb327..677194f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ include Makefile.gtester
 
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
-SUBDIRS = shm gvdb common engine service gdbus gsettings dbus-1 client bin docs tests
+SUBDIRS = shm gvdb common engine service gdbus gsettings dbus-1 client bin docs tests po
 
 if ENABLE_EDITOR
 SUBDIRS += editor
diff --git a/autogen.sh b/autogen.sh
index 89f7ad7..c929f33 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -21,6 +21,7 @@ else
 fi
 
 mkdir -p m4 aux
+intltoolize --force
 gtkdocize --docdir docs --flavour no-tmpl
 aclocal${automake_suffix} ${ACLOCAL_FLAGS}
 autoheader
diff --git a/configure.ac b/configure.ac
index c1e9fa3..f82571c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,14 @@ if test "x$enable_gcov" == "xyes"; then
   LDFLAGS="$LDFLAGS -lgcov"
 fi
 
+dnl Gettext support
+GETTEXT_PACKAGE=dconf
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define the gettext package to be used])
+
+AM_GLIB_GNU_GETTEXT
+IT_PROG_INTLTOOL([0.50.0])
+
 AC_CONFIG_FILES([
   common/Makefile
   shm/Makefile
@@ -79,9 +87,10 @@ AC_CONFIG_FILES([
   dbus-1/Makefile
   bin/Makefile
   editor/Makefile
-  editor/dconf-editor.desktop
+  editor/dconf-editor.desktop.in
   tests/Makefile
   docs/Makefile
+  po/Makefile.in
   Makefile
 ])
 AC_OUTPUT
diff --git a/editor/.gitignore b/editor/.gitignore
index 5660400..5f339b3 100644
--- a/editor/.gitignore
+++ b/editor/.gitignore
@@ -2,4 +2,5 @@
 *.stamp
 dconf-editor
 dconf-editor.desktop
+dconf-editor.desktop.in
 ca.desrt.dconf-editor.gschema.valid
diff --git a/editor/Makefile.am b/editor/Makefile.am
index 02ed174..76f3335 100644
--- a/editor/Makefile.am
+++ b/editor/Makefile.am
@@ -19,7 +19,8 @@ dconf_editor_CFLAGS = \
 	$(libxml_CFLAGS)			\
 	-DPKGDATADIR=\"$(pkgdatadir)\"		\
 	-DVERSION=\"$(VERSION)\"		\
-	-DGETTEXT_PACKAGE=\"dconf-editor\"	\
+	-DLOCALEDIR=\"$(localedir)\"		\
+	-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\"\
 	-w
 
 dconf_editor_SOURCES = \
@@ -32,6 +33,7 @@ dconf_editor_SOURCES = \
 desktopdir = $(datadir)/applications
 desktop_in_files = dconf-editor.desktop.in.in
 desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
+ INTLTOOL_DESKTOP_RULE@
 
 gsettings_SCHEMAS = ca.desrt.dconf-editor.gschema.xml
 @GSETTINGS_RULES@
diff --git a/editor/ca.desrt.dconf-editor.gschema.xml b/editor/ca.desrt.dconf-editor.gschema.xml
index 90a3248..b44ad13 100644
--- a/editor/ca.desrt.dconf-editor.gschema.xml
+++ b/editor/ca.desrt.dconf-editor.gschema.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<schemalist>
+<schemalist gettext-domain='dconf'>
   <schema id="ca.desrt.dconf-editor.Settings" path="/ca/desrt/dconf-editor/">
     <key name="width" type="i">
       <default>800</default>
diff --git a/editor/config.vapi b/editor/config.vapi
index f697a31..b114ca3 100644
--- a/editor/config.vapi
+++ b/editor/config.vapi
@@ -3,5 +3,6 @@ namespace Config
 {
   public const string PKGDATADIR;
   public const string GETTEXT_PACKAGE;
+  public const string LOCALEDIR;
   public const string VERSION;
 }
diff --git a/editor/dconf-editor.desktop.in b/editor/dconf-editor.desktop.in.in
similarity index 77%
rename from editor/dconf-editor.desktop.in
rename to editor/dconf-editor.desktop.in.in
index 446911c..2daff06 100644
--- a/editor/dconf-editor.desktop.in
+++ b/editor/dconf-editor.desktop.in.in
@@ -1,6 +1,6 @@
 [Desktop Entry]
-Name=dconf Editor
-Comment=Directly edit your entire configuration database
+_Name=dconf Editor
+_Comment=Directly edit your entire configuration database
 Exec=dconf-editor
 Terminal=false
 Type=Application
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index f4849e4..0a114fd 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -355,6 +355,11 @@ class ConfigurationEditor : Gtk.Application
 
     public static int main(string[] args)
     {
+		Intl.setlocale (LocaleCategory.ALL, "");
+		Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
+		Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
+		Intl.textdomain (Config.GETTEXT_PACKAGE);
+
         var app = new ConfigurationEditor();
         return app.run(args);
     }
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 0000000..6a0fe87
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,5 @@
+/Makefile.in.in
+/POTFILES
+/stamp-it
+/dconf.pot
+/*.gmo
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..97575e3
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,9 @@
+editor/dconf-editor.desktop.in
+editor/dconf-editor.vala
+editor/dconf-model.vala
+editor/dconf-schema.vala
+editor/dconf-view.vala
+[type: gettext/glade] editor/dconf-editor.ui
+[type: gettext/glade] editor/dconf-editor-menu.ui
+[type: gettext/glade] editor/dconf-editor-menu.ui
+[type: gettext/gsettings] editor/ca.desrt.dconf-editor.gschema.xml
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644
index 0000000..19d8dce
--- /dev/null
+++ b/po/POTFILES.skip
@@ -0,0 +1,3 @@
+editor/dconf-editor.c
+editor/dconf-editor.desktop.in.in
+editor/dconf-view.c



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