[beast: 4/6] BSE: leave gettext to glib-extra.hh, provide _ and N_ only for BSE_COMPILATION



commit 56a1ffc15b0403b27c1009750ae75738981510d7
Author: Tim Janik <timj gnu org>
Date:   Wed Jun 21 11:49:05 2017 +0200

    BSE: leave gettext to glib-extra.hh, provide _ and N_ only for BSE_COMPILATION
    
    Signed-off-by: Tim Janik <timj gnu org>

 bse/bseconfig.h.in |    1 -
 bse/bsedefs.hh     |   12 +++++-------
 bse/bsemain.cc     |   23 -----------------------
 bse/bsemain.hh     |    1 -
 4 files changed, 5 insertions(+), 32 deletions(-)
---
diff --git a/bse/bseconfig.h.in b/bse/bseconfig.h.in
index 2a29e71..275f963 100644
--- a/bse/bseconfig.h.in
+++ b/bse/bseconfig.h.in
@@ -13,7 +13,6 @@ extern "C" {
 #define BST_MAJOR_VERSION                               (@MAJOR@)
 #define BST_MINOR_VERSION                               (@MINOR@)
 #define BST_MICRO_VERSION                               (@MICRO@)
-#define        BSE_GETTEXT_DOMAIN                              ("@BST_GETTEXT_DOMAIN@")
 
 /* check for header versions
  */
diff --git a/bse/bsedefs.hh b/bse/bsedefs.hh
index f2eddea..1ba9dba 100644
--- a/bse/bsedefs.hh
+++ b/bse/bsedefs.hh
@@ -4,7 +4,6 @@
 
 #undef   G_DISABLE_ASSERT
 #undef   G_DISABLE_CHECKS
-#include <libintl.h>
 #include <sfi/sfi.hh>
 #include <sfi/sfistore.hh>     // FIXME
 #include <sfi/sficomwire.hh>   // FIXME
@@ -129,14 +128,13 @@ typedef gboolean      (*BseCategoryForeach)  (const gchar       *category_path,
                                               GType              type,
                                               gpointer           user_data);
 typedef void          (*BseEngineAccessFunc) (BseModule         *module,
-                                              gpointer           data); 
+                                              gpointer           data);
 
-
-
-/* --- i18n and gettext helpers --- */
-const gchar* bse_gettext (const gchar *text);
-#define _(str) bse_gettext (str)
+// == i18n Helpers ==
+#ifdef BSE_COMPILATION
+#define _(str)  ::Bse::_ (str)
 #define N_(str) (str)
+#endif /* BSE_COMPILATION */
 
 namespace Bse {
 
diff --git a/bse/bsemain.cc b/bse/bsemain.cc
index ac218be..2a08b0f 100644
--- a/bse/bsemain.cc
+++ b/bse/bsemain.cc
@@ -50,26 +50,6 @@ static BseMainArgs       default_main_args = {
 BseMainArgs             *bse_main_args = NULL;
 
 // == BSE Initialization ==
-static bool bindtextdomain_initialized = false;
-
-/// Bind the BSE text domain, so bse_gettext() becomes usable; may be called before initializing BSE.
-void
-bse_bindtextdomain()
-{
-  assert_return (bindtextdomain_initialized == false);
-  bindtextdomain (BSE_GETTEXT_DOMAIN, Bse::installpath (Bse::INSTALLPATH_LOCALEBASE).c_str());
-  bind_textdomain_codeset (BSE_GETTEXT_DOMAIN, "UTF-8");
-  bindtextdomain_initialized = true;
-}
-
-/// Translate message strings used in the BSE library.
-const gchar*
-bse_gettext (const gchar *text)
-{
-  assert (bindtextdomain_initialized == true);
-  return dgettext (BSE_GETTEXT_DOMAIN, text);
-}
-
 static gboolean single_thread_registration_done = FALSE;
 
 static void
@@ -202,9 +182,6 @@ initialize_with_argv (int *argc, char **argv, const char *app_name, const Bse::S
   assert (_bse_initialized() == false);
   assert (bse_main_context == NULL);
 
-  // ensure textdomain for error messages
-  if (!bindtextdomain_initialized)
-    bse_bindtextdomain();
   // setup GLib's prgname for error messages
   if (argc && argv && *argc && !g_get_prgname ())
     g_set_prgname (*argv);
diff --git a/bse/bsemain.hh b/bse/bsemain.hh
index 3e4de7e..9a235bb 100644
--- a/bse/bsemain.hh
+++ b/bse/bsemain.hh
@@ -3,7 +3,6 @@
 #define __BSE_MAIN_H__
 #include        <bse/bsetype.hh>
 // == BSE Initialization ==
-void bse_bindtextdomain ();
 void _bse_init_async   (int *argc, char **argv, const char *app_name, const Bse::StringVector &args);
 bool _bse_initialized  ();
 void bse_init_inprocess        (int *argc, char **argv, const char *app_name, const Bse::StringVector &args 
= Bse::StringVector());


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