[rygel] core,ui,build: Make i18n system actually work



commit 9afcbf7a1d49fd0b85835e971e7bc5d1f45ca1cf
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Sep 28 18:05:58 2010 +0300

    core,ui,build: Make i18n system actually work
    
    Based on a patch from Jonh Wendell <jwendell gnome org>.

 src/rygel/Makefile.am                |    3 ++-
 src/rygel/rygel-build-config.vapi    |    6 ++++++
 src/rygel/rygel-main.vala            |    6 ++++++
 src/ui/Makefile.am                   |    3 ++-
 src/ui/rygel-preferences-dialog.vala |    6 ++++++
 5 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/Makefile.am b/src/rygel/Makefile.am
index a6f6321..49a2712 100644
--- a/src/rygel/Makefile.am
+++ b/src/rygel/Makefile.am
@@ -25,7 +25,8 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
 	    -DDATA_DIR='"$(shareddir)"' -DSYS_CONFIG_DIR='"$(sysconfdir)"'\
 	    -DPLUGIN_DIR='"$(plugindir)"' -DDESKTOP_DIR='"$(desktopdir)"'\
 	    -DSMALL_ICON_DIR='"$(smallicondir)"' \
-	    -DBIG_ICON_DIR='"$(bigicondir)"' -include config.h
+	    -DBIG_ICON_DIR='"$(bigicondir)"' -include config.h \
+	    -DLOCALEDIR=\""$(datadir)/locale"\"
 
 librygelincdir = $(includedir)/rygel-1.0
 
diff --git a/src/rygel/rygel-build-config.vapi b/src/rygel/rygel-build-config.vapi
index c0bf3f9..9b331a0 100644
--- a/src/rygel/rygel-build-config.vapi
+++ b/src/rygel/rygel-build-config.vapi
@@ -51,4 +51,10 @@ public class Rygel.BuildConfig {
 
     [CCode (cname = "PACKAGE_STRING")]
     public static const string PACKAGE_STRING;
+
+    [CCode (cname = "GETTEXT_PACKAGE")]
+    public static const string GETTEXT_PACKAGE;
+
+    [CCode (cname = "LOCALEDIR")]
+    public static const string LOCALEDIR;
 }
diff --git a/src/rygel/rygel-main.vala b/src/rygel/rygel-main.vala
index 8a983e7..772ffa4 100644
--- a/src/rygel/rygel-main.vala
+++ b/src/rygel/rygel-main.vala
@@ -212,6 +212,12 @@ public class Rygel.Main : Object {
 
         var original_args = args;
 
+        Intl.setlocale (LocaleCategory.ALL, "");
+        Intl.bindtextdomain (BuildConfig.GETTEXT_PACKAGE,
+                             BuildConfig.LOCALEDIR);
+        Intl.bind_textdomain_codeset (BuildConfig.GETTEXT_PACKAGE, "UTF-8");
+        Intl.textdomain (BuildConfig.GETTEXT_PACKAGE);
+
         try {
             // Parse commandline options
             CmdlineConfig.parse_args (ref args);
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index c339929..8500acf 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -18,7 +18,8 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
 	    $(LIBSOUP_CFLAGS) \
 	    $(LIBDBUS_GLIB_CFLAGS) \
 	    -I$(top_srcdir) -I$(rygeldir) -DDATA_DIR='"$(shareddir)"' \
-	    -DSMALL_ICON_DIR='"$(icondir)"' -include config.h
+	    -DSMALL_ICON_DIR='"$(icondir)"' -include config.h \
+	    -DLOCALEDIR=\""$(datadir)/locale"\"
 
 bin_PROGRAMS = rygel-preferences
 
diff --git a/src/ui/rygel-preferences-dialog.vala b/src/ui/rygel-preferences-dialog.vala
index 4e88cae..b94a707 100644
--- a/src/ui/rygel-preferences-dialog.vala
+++ b/src/ui/rygel-preferences-dialog.vala
@@ -62,6 +62,12 @@ public class Rygel.PreferencesDialog : GLib.Object {
     }
 
     public static int main (string[] args) {
+        Intl.setlocale (LocaleCategory.ALL, "");
+        Intl.bindtextdomain (BuildConfig.GETTEXT_PACKAGE,
+                             BuildConfig.LOCALEDIR);
+        Intl.bind_textdomain_codeset (BuildConfig.GETTEXT_PACKAGE, "UTF-8");
+        Intl.textdomain (BuildConfig.GETTEXT_PACKAGE);
+
         Gtk.init (ref args);
 
         try {



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