[dia/neduard/meson_fixes] #31 Always use bind_textdomain_codeset.



commit 22d340f9358ff882c4b458b1d742c6f8ea3fa830
Author: Eduard <eddnicodei gmail com>
Date:   Thu Jan 31 21:10:35 2019 +0000

    #31 Always use bind_textdomain_codeset.
    
      - Note: apparently this might not be defined on all platforms,
        the ones we support should have it defined hopefully?
        (see bugzilla 125926, or ChangeLog.pre-git)
      - Also cleanup app/app_procs.c _setup_textdomains, the localedir
        should be correctly returned by libdia.
      - Remove extraneous glib/gi18n.h include from diagram_tree_view.c
      - keep .intltool-merge-cache in build_dir and not in po/

 app/app_procs.c         | 14 +++-----------
 app/diagram_tree_view.c |  1 -
 lib/intl.h              |  1 +
 meson.build             |  2 ++
 po/meson.build          | 14 +++++++++++---
 5 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/app/app_procs.c b/app/app_procs.c
index aab2a590..744c6b68 100644
--- a/app/app_procs.c
+++ b/app/app_procs.c
@@ -594,21 +594,13 @@ _check_option_output_directory (const gchar    *option_name,
 static void
 _setup_textdomains (void)
 {
-#ifdef G_OS_WIN32
   /* calculate runtime directory */
-  {
-    gchar* localedir = dia_get_locale_directory ();
+  gchar* localedir = dia_get_locale_directory();
 
-    bindtextdomain(GETTEXT_PACKAGE, localedir);
-    g_free (localedir);
-  }
-#else
-  bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
-#endif
+  bindtextdomain(GETTEXT_PACKAGE, localedir);
+  g_free (localedir);
 
-#if defined ENABLE_NLS && defined HAVE_BIND_TEXTDOMAIN_CODESET
   bind_textdomain_codeset(GETTEXT_PACKAGE,"UTF-8");  
-#endif
   textdomain(GETTEXT_PACKAGE);
 }
 
diff --git a/app/diagram_tree_view.c b/app/diagram_tree_view.c
index cd42a91a..501bcfff 100644
--- a/app/diagram_tree_view.c
+++ b/app/diagram_tree_view.c
@@ -27,7 +27,6 @@
 #include <string.h>
 
 #include <gtk/gtk.h>
-#include <glib/gi18n.h>
 
 #include <lib/object.h>
 
diff --git a/lib/intl.h b/lib/intl.h
index 645e45a3..b1210e94 100644
--- a/lib/intl.h
+++ b/lib/intl.h
@@ -13,6 +13,7 @@
 #  define gettext(String) (String)
 #  define textdomain(Domain)
 #  define bindtextdomain(Package, Directory)
+#  define bind_textdomain_codeset(Package, Codeset)
 #endif
 
 int    intl_score_locale      (const gchar *locale);
diff --git a/meson.build b/meson.build
index 07e870ae..55483831 100644
--- a/meson.build
+++ b/meson.build
@@ -60,6 +60,8 @@ conf.set_quoted('PREFIX', get_option('prefix'))
 conf.set_quoted('PKGDATADIR', pkgdatadir)
 conf.set_quoted('DIALIBDIR',  dialibdir)
 conf.set_quoted('LOCALEDIR', localedir)
+# TODO: Should we make i18n optional?  Are there still platforms that
+# don't support it?
 conf.set('ENABLE_NLS', true)
 
 foreach h : ['stddef.h', 'fcntl.h', 'unistd.h', 'utime.h']
diff --git a/po/meson.build b/po/meson.build
index b2c92e94..5598ed18 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -4,11 +4,19 @@ intltool_merge = find_program('intltool-merge')
 
 po_dir = meson.current_source_dir()
 
-intltool_cache = join_paths(po_dir, '.intltool-merge-cache')
+intltool_cache = join_paths(
+    meson.current_build_dir(),
+    '.intltool-merge-cache'
+)
+
 intltool_command = [
-    intltool_merge, '-x', '-u',
+    intltool_merge,
+    '-x',
+    '-u',
     '-c', intltool_cache,
-    po_dir, '@INPUT@', '@OUTPUT@'
+    po_dir,
+    '@INPUT@',
+    '@OUTPUT@'
 ]
 
 i18n.gettext(meson.project_name())


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