add i18n support

This commit is contained in:
Lennart Poettering 2008-08-06 18:54:13 +02:00
parent c4a953dc96
commit f1d2bf8408
35 changed files with 816 additions and 414 deletions

View file

@ -32,13 +32,12 @@
#include <sys/dl.h>
#endif
#ifndef HAVE_STRUCT_LT_USER_DLLOADER
/* Only used with ltdl 2.2 */
#include <string.h>
#endif
#include <ltdl.h>
#include <pulse/i18n.h>
#include <pulsecore/macro.h>
#include <pulsecore/mutex.h>
#include <pulsecore/thread.h>
@ -54,6 +53,8 @@
#undef PA_BIND_NOW
#endif
#ifdef HAVE_LT_DLMUTEX_REGISTER
static pa_mutex *libtool_mutex = NULL;
PA_STATIC_TLS_DECLARE_NO_FREE(libtool_tls);
@ -74,6 +75,8 @@ static const char *libtool_get_error(void) {
return PA_STATIC_TLS_GET(libtool_tls);
}
#endif
#ifdef PA_BIND_NOW
/*
@ -89,10 +92,11 @@ static const char *libtool_get_error(void) {
*/
#ifndef HAVE_LT_DLADVISE
static lt_module bind_now_open(lt_user_data d, const char *fname) {
static lt_module bind_now_open(lt_user_data d, const char *fname)
#else
static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise) {
static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise)
#endif
{
lt_module m;
pa_assert(fname);
@ -150,8 +154,9 @@ void pa_ltdl_init(void) {
#endif
pa_assert_se(lt_dlinit() == 0);
pa_assert_se(libtool_mutex = pa_mutex_new(TRUE, FALSE));
#ifdef HAVE_LT_DLMUTEX_REGISTER
pa_assert_se(libtool_mutex = pa_mutex_new(TRUE, FALSE));
pa_assert_se(lt_dlmutex_register(libtool_lock, libtool_unlock, libtool_set_error, libtool_get_error) == 0);
#endif
@ -163,14 +168,15 @@ void pa_ltdl_init(void) {
/* Add our BIND_NOW loader as the default module loader. */
if (lt_dlloader_add(place, &loader, "bind-now-loader") != 0)
pa_log_warn("Failed to add bind-now-loader.");
pa_log_warn(_("Failed to add bind-now-loader."));
# else
/* Already initialised */
if ( dlopen_loader != NULL ) return;
if (dlopen_loader)
return;
if (!(dlopen_loader = lt_dlloader_find("dlopen"))) {
pa_log_warn("Failed to find original dlopen loader.");
return;
pa_log_warn(_("Failed to find original dlopen loader."));
return;
}
memcpy(&bindnow_loader, dlopen_loader, sizeof(bindnow_loader));
@ -182,14 +188,16 @@ void pa_ltdl_init(void) {
/* Add our BIND_NOW loader as the default module loader. */
if (lt_dlloader_add(&bindnow_loader) != 0)
pa_log_warn("Failed to add bind-now-loader.");
pa_log_warn(_("Failed to add bind-now-loader."));
# endif
#endif
}
void pa_ltdl_done(void) {
pa_assert_se(lt_dlexit() == 0);
#ifdef HAVE_LT_DLMUTEX_REGISTER
pa_mutex_free(libtool_mutex);
libtool_mutex = NULL;
#endif
}