hal/libhal libhal.c,1.26,1.27

David Zeuthen david at freedesktop.org
Thu Sep 23 11:13:47 PDT 2004


Update of /cvs/hal/hal/libhal
In directory gabe:/tmp/cvs-serv17124/libhal

Modified Files:
	libhal.c 
Log Message:
2004-09-23  David Zeuthen  <david at fubar.dk>

	* po/POTFILES.in: New file

	* libhal-storage/libhal-storage.h: New file

	* libhal-storage/libhal-storage.c: New file

	* libhal/libhal.c: Add dgettext support
	(hal_initialize): Bind to translation domain (but only once)

	* doc/api/Makefile.am (htmldocdir): Rename to api from libhal

	* Doxyfile.in: Add libhal-storage

	* configure.in: Add checks for i18n tools. Add hal-storage.pc,
	libhal-storage/Makefile and po/Makefile.in to AC_OUTPUT

	* autogen.sh: Add checks for i18n tools

	* hal-storage.pc.in: New file

	* Makefile.am: Add libhal-storage and po to SUBDIRS. Add hal-storage.pc



Index: libhal.c
===================================================================
RCS file: /cvs/hal/hal/libhal/libhal.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- libhal.c	17 Sep 2004 17:05:48 -0000	1.26
+++ libhal.c	23 Sep 2004 18:13:45 -0000	1.27
@@ -34,6 +34,25 @@
 
 #include "libhal.h"
 
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(String) dgettext (GETTEXT_PACKAGE, String)
+# ifdef gettext_noop
+#   define N_(String) gettext_noop (String)
+# else
+#   define N_(String) (String)
+# endif
+#else
+/* Stubs that do something close enough.  */
+# define textdomain(String) (String)
+# define gettext(String) (String)
+# define dgettext(Domain,Message) (Message)
+# define dcgettext(Domain,Message,Type) (Message)
+# define bindtextdomain(Domain,Directory) (Domain)
+# define _(String)
+# define N_(String) (String)
+#endif
+
 /**
  * @defgroup LibHal HAL convenience library
  * @brief A convenience library used to communicate with the HAL daemon
@@ -557,6 +576,9 @@
 };
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
+/* for i18n purposes */
+static dbus_bool_t hal_already_initialized_once = FALSE;
+
 /** Initialize the HAL library. 
  *
  *  @param  cb_functions	  Callback functions. If this is set top NULL
@@ -581,6 +603,13 @@
 {
 	DBusError error;
 	LibHalContext *ctx;
+
+	if (!hal_already_initialized_once) {
+		bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+		bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+		
+		hal_already_initialized_once = TRUE;
+	}
 	
 	ctx = malloc (sizeof (LibHalContext));
 	if (ctx == NULL) {




More information about the hal-commit mailing list