diff options
author | David Zeuthen <david@fubar.dk> | 2004-09-23 18:13:45 +0000 |
---|---|---|
committer | David Zeuthen <david@fubar.dk> | 2004-09-23 18:13:45 +0000 |
commit | 60db48284a970ad9caa1eef6ca250a7370461c31 (patch) | |
tree | 4ba748326adc30bb97b2583e7937ee1d1ffa4a2e /libhal | |
parent | 69d8cbcaa393f36f2771cff6b16d51190448a971 (diff) |
New file
New file
New file
Add dgettext support (hal_initialize): Bind to translation domain (but only
once)
Rename to api from libhal
Add libhal-storage
Add checks for i18n tools. Add hal-storage.pc, libhal-storage/Makefile and
po/Makefile.in to AC_OUTPUT
Add checks for i18n tools
New file
Add libhal-storage and po to SUBDIRS. Add hal-storage.pc
Diffstat (limited to 'libhal')
-rw-r--r-- | libhal/libhal.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libhal/libhal.c b/libhal/libhal.c index 457e152b..73cc1723 100644 --- a/libhal/libhal.c +++ b/libhal/libhal.c @@ -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 @@ static LibHalFunctions hal_null_functions = { }; #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 @@ hal_initialize (const LibHalFunctions * cb_functions, { 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) { |