[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.11-67-gf1d2bf8
Lennart Poettering
gitmailer-noreply at 0pointer.de
Wed Aug 6 09:54:17 PDT 2008
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The master branch has been updated
from 34dd4a20f2e976b260e8aa3f3128e55ec80bb85b (commit)
- Log -----------------------------------------------------------------
f1d2bf8... add i18n support
c4a953d... remove authkey-prop from tree
b4e8cac... don't include authkey-prop.h anymore
9fde00e... fix a few potential bad memory accesses
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 5 +
Makefile.am | 7 +-
bootstrap.sh | 19 ++-
configure.ac | 12 ++
po/.gitignore | 12 ++
po/POTFILES.in | 192 +++++++++++++++++++++++
po/POTFILES.skip | 1 +
src/Makefile.am | 7 +-
src/daemon/caps.c | 13 +-
src/daemon/cmdline.c | 29 ++--
src/daemon/daemon-conf.c | 27 ++--
src/daemon/dumpmodules.c | 17 +-
src/daemon/ltdl-bind-now.c | 32 +++--
src/daemon/main.c | 117 +++++++-------
src/daemon/polkit.c | 26 ++--
src/pulse/channelmap.c | 127 ++++++++--------
src/pulse/client-conf-x11.c | 5 +-
src/pulse/client-conf.c | 3 +-
src/pulse/context.c | 15 +-
src/pulse/error.c | 49 +++---
src/{pulsecore/proplist-util.h => pulse/i18n.c} | 21 ++-
src/pulse/{utf8.h => i18n.h} | 45 ++++--
src/pulse/mainloop-api.c | 3 +
src/pulse/mainloop-signal.c | 3 +
src/pulse/mainloop.c | 3 +
src/pulse/proplist.c | 3 +
src/pulse/sample.c | 8 +-
src/pulse/simple.c | 1 -
src/pulse/thread-mainloop.c | 3 +
src/pulsecore/authkey-prop.c | 104 ------------
src/pulsecore/authkey-prop.h | 43 -----
src/pulsecore/core-util.c | 9 +-
src/pulsecore/protocol-native.c | 1 -
src/utils/pacat.c | 109 +++++++-------
src/utils/pacmd.c | 26 ++--
src/utils/pactl.c | 152 +++++++++---------
src/utils/paplay.c | 43 +++---
src/utils/pasuspender.c | 44 +++---
src/utils/pax11publish.c | 35 +++--
39 files changed, 776 insertions(+), 595 deletions(-)
create mode 100644 po/.gitignore
create mode 100644 po/POTFILES.in
create mode 100644 po/POTFILES.skip
copy src/{pulsecore/proplist-util.h => pulse/i18n.c} (74%)
copy src/pulse/{utf8.h => i18n.h} (51%)
delete mode 100644 src/pulsecore/authkey-prop.c
delete mode 100644 src/pulsecore/authkey-prop.h
-----------------------------------------------------------------------
commit 9fde00e449f2892f67f4cf2f7f7bf66f014f08a0
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Aug 6 03:04:22 2008 +0200
fix a few potential bad memory accesses
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index c4818e3..7c1534a 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -1185,7 +1185,7 @@ static char *get_dir(mode_t m, const char *env_name) {
}
if (st.st_uid != getuid()) {
- pa_log_error("Home directory %s not ours.", d);
+ pa_log_error("Home directory %s not ours.", h);
return NULL;
}
@@ -1253,6 +1253,8 @@ FILE *pa_open_config_file(const char *global, const char *local, const char *env
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", e, local);
else if (pa_get_home_dir(h, sizeof(h)))
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP ".pulse" PA_PATH_SEP "%s", h, local);
+ else
+ return NULL;
#ifdef OS_IS_WIN32
if (!ExpandEnvironmentStrings(lfn, buf, PATH_MAX)) {
@@ -1311,6 +1313,7 @@ char *pa_find_config_file(const char *global, const char *local, const char *env
#endif
if (env && (fn = getenv(env))) {
+
#ifdef OS_IS_WIN32
if (!ExpandEnvironmentStrings(fn, buf, PATH_MAX))
return NULL;
@@ -1333,6 +1336,8 @@ char *pa_find_config_file(const char *global, const char *local, const char *env
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", e, local);
else if (pa_get_home_dir(h, sizeof(h)))
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP ".pulse" PA_PATH_SEP "%s", h, local);
+ else
+ return NULL;
#ifdef OS_IS_WIN32
if (!ExpandEnvironmentStrings(lfn, buf, PATH_MAX)) {
@@ -1364,7 +1369,7 @@ char *pa_find_config_file(const char *global, const char *local, const char *env
global = buf;
#endif
- if (access(fn, R_OK) == 0)
+ if (access(global, R_OK) == 0)
return pa_xstrdup(global);
} else
errno = ENOENT;
commit b4e8cac06675816835db96f67f86ae363bc77e55
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Aug 6 03:04:53 2008 +0200
don't include authkey-prop.h anymore
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 9378477..f0d8790 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -50,7 +50,6 @@
#include <pulsecore/core-subscribe.h>
#include <pulsecore/log.h>
#include <pulsecore/autoload.h>
-#include <pulsecore/authkey-prop.h>
#include <pulsecore/strlist.h>
#include <pulsecore/shared.h>
#include <pulsecore/sample-util.h>
commit c4a953dc963fc8522b5ccdc35884fedafad1febe
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Aug 6 03:05:20 2008 +0200
remove authkey-prop from tree
diff --git a/src/pulsecore/authkey-prop.c b/src/pulsecore/authkey-prop.c
deleted file mode 100644
index d52bdcf..0000000
--- a/src/pulsecore/authkey-prop.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/***
- This file is part of PulseAudio.
-
- Copyright 2004-2006 Lennart Poettering
-
- PulseAudio is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- PulseAudio is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with PulseAudio; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <pulse/xmalloc.h>
-
-#include <pulsecore/shared.h>
-#include <pulsecore/macro.h>
-#include <pulsecore/log.h>
-#include <pulsecore/refcnt.h>
-
-#include "authkey-prop.h"
-
-struct authkey_data {
- PA_REFCNT_DECLARE;
- size_t length;
-};
-
-int pa_authkey_prop_get(pa_core *c, const char *name, void *data, size_t len) {
- struct authkey_data *a;
-
- pa_assert(c);
- pa_assert(name);
- pa_assert(data);
- pa_assert(len > 0);
-
- if (!(a = pa_shared_get(c, name)))
- return -1;
-
- pa_assert(a->length == len);
- memcpy(data, (uint8_t*) a + PA_ALIGN(sizeof(struct authkey_data)), len);
-
- return 0;
-}
-
-int pa_authkey_prop_put(pa_core *c, const char *name, const void *data, size_t len) {
- struct authkey_data *a;
-
- pa_assert(c);
- pa_assert(name);
-
- if (pa_shared_get(c, name))
- return -1;
-
- a = pa_xmalloc(PA_ALIGN(sizeof(struct authkey_data)) + len);
- PA_REFCNT_INIT(a);
- a->length = len;
- memcpy((uint8_t*) a + PA_ALIGN(sizeof(struct authkey_data)), data, len);
-
- pa_shared_set(c, name, a);
-
- return 0;
-}
-
-void pa_authkey_prop_ref(pa_core *c, const char *name) {
- struct authkey_data *a;
-
- pa_assert(c);
- pa_assert(name);
-
- a = pa_shared_get(c, name);
- pa_assert(a);
- pa_assert(PA_REFCNT_VALUE(a) >= 1);
- PA_REFCNT_INC(a);
-}
-
-void pa_authkey_prop_unref(pa_core *c, const char *name) {
- struct authkey_data *a;
-
- pa_assert(c);
- pa_assert(name);
-
- a = pa_shared_get(c, name);
- pa_assert(a);
- pa_assert(PA_REFCNT_VALUE(a) >= 1);
-
- if (PA_REFCNT_DEC(a) <= 0) {
- pa_shared_remove(c, name);
- pa_xfree(a);
- }
-}
diff --git a/src/pulsecore/authkey-prop.h b/src/pulsecore/authkey-prop.h
deleted file mode 100644
index de02d2a..0000000
--- a/src/pulsecore/authkey-prop.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef fooauthkeyprophfoo
-#define fooauthkeyprophfoo
-
-/***
- This file is part of PulseAudio.
-
- Copyright 2004-2006 Lennart Poettering
-
- PulseAudio is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- PulseAudio is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with PulseAudio; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <pulsecore/core.h>
-
-/* The authkey-prop uses a central property to store a previously
- * loaded cookie in memory. Useful for sharing the same cookie between
- * several modules. */
-
-/* Return the data of the specified authorization key property. Doesn't alter the refernce count of the key */
-int pa_authkey_prop_get(pa_core *c, const char *name, void *data, size_t len);
-
-/* Store data in the specified authorization key property. The initial reference count is set to 1 */
-int pa_authkey_prop_put(pa_core *c, const char *name, const void *data, size_t len);
-
-/* Increase the reference count of the specified authorization key */
-void pa_authkey_prop_ref(pa_core *c, const char *name);
-
-/* Decrease the reference count of the specified authorization key */
-void pa_authkey_prop_unref(pa_core *c, const char *name);
-
-#endif
commit f1d2bf84089b1e5b5988a5e5d6d571a507a52337
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Aug 6 18:54:13 2008 +0200
add i18n support
diff --git a/.gitignore b/.gitignore
index 30e1967..80d9ac7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,8 @@
+ABOUT-NLS
+common/
+intltool-extract.in
+intltool-merge.in
+intltool-update.in
*~
*.tar.gz
*.pc
diff --git a/Makefile.am b/Makefile.am
index b32b46e..63c04ee 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,8 +15,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
+ACLOCAL_AMFLAGS = -I common
+
EXTRA_DIST = bootstrap.sh LICENSE GPL LGPL doxygen/Makefile.am doxygen/Makefile.in doxygen/doxygen.conf.in README todo
-SUBDIRS=src doxygen man
+SUBDIRS=src doxygen man po
MAINTAINERCLEANFILES =
noinst_DATA =
@@ -60,3 +62,6 @@ dist-hook:
fi
.PHONY: homepage distcleancheck doxygen
+
+DISTCLEANFILES = \
+ po/.intltool-merge-cache
diff --git a/bootstrap.sh b/bootstrap.sh
index ceea55b..6f060c8 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -23,12 +23,12 @@ run_versioned() {
local V
V=$(echo "$2" | sed -e 's,\.,,g')
-
+
if [ -e "`which $1$V 2> /dev/null`" ] ; then
- P="$1$V"
+ P="$1$V"
else
if [ -e "`which $1-$2 2> /dev/null`" ] ; then
- P="$1-$2"
+ P="$1-$2"
else
P="$1"
fi
@@ -43,21 +43,28 @@ set -ex
if [ "x$1" = "xam" ] ; then
run_versioned automake "$VERSION" -a -c --foreign
./config.status
-else
+else
rm -rf autom4te.cache
rm -f config.cache
+ rm -f Makefile.am~ configure.ac~
+ # Evil, evil, evil, evil hack
+ sed 's/read dummy/\#/' `which gettextize` | sh -s -- --copy --force
+ test -f Makefile.am~ && mv Makefile.am~ Makefile.am
+ test -f configure.ac~ && mv configure.ac~ configure.ac
+
touch config.rpath
test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize
+ intltoolize --copy --force --automake
"$LIBTOOLIZE" -c --force --ltdl
- run_versioned aclocal "$VERSION"
+ run_versioned aclocal "$VERSION" -I common
run_versioned autoconf 2.59 -Wall
run_versioned autoheader 2.59
run_versioned automake "$VERSION" --copy --foreign --add-missing
if test "x$NOCONFIGURE" = "x"; then
- CFLAGS="-g -O0" ./configure --sysconfdir=/etc --localstatedir=/var --enable-force-preopen "$@"
+ CFLAGS="-g -O0" ./configure --sysconfdir=/etc --localstatedir=/var --enable-force-preopen "$@"
make clean
fi
fi
diff --git a/configure.ac b/configure.ac
index 80a06f0..25a86a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -440,6 +440,17 @@ AC_CHECK_FUNCS([open64])
AM_ICONV
+AM_GNU_GETTEXT([external])
+
+IT_PROG_INTLTOOL([0.35.0])
+GETTEXT_PACKAGE=pulseaudio
+AC_SUBST([GETTEXT_PACKAGE])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
+AM_GLIB_GNU_GETTEXT
+
+pulselocaledir='${prefix}/${DATADIRNAME}/locale'
+AC_SUBST(pulselocaledir)
+
###################################
# External libraries #
###################################
@@ -1128,6 +1139,7 @@ libpulse-mainloop-glib.pc
doxygen/Makefile
doxygen/doxygen.conf
src/pulse/version.h
+po/Makefile.in
])
AC_OUTPUT
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 0000000..d6e4033
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,12 @@
+Makefile.in.in
+Makevars.template
+POTFILES
+Rules-quot
+boldquot.sed
+en at boldquot.header
+en at quot.header
+insert-header.sin
+pulseaudio.pot
+quot.sed
+remove-potcdate.sin
+ChangeLog
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..fa28b6a
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,192 @@
+src/modules/module-rescue-streams.c
+src/modules/module-tunnel.c
+src/modules/module-native-protocol-fd.c
+src/modules/module-zeroconf-discover.c
+src/modules/module-alsa-source.c
+src/modules/module-device-restore.c
+src/modules/module-match.c
+src/modules/dbus-util.c
+src/modules/module-console-kit.c
+src/modules/module-oss.c
+src/modules/oss-util.c
+src/modules/module-mmkbd-evdev.c
+src/modules/module-position-event-sounds.c
+src/modules/alsa-util.c
+src/modules/module-pipe-source.c
+src/modules/module-solaris.c
+src/modules/module-default-device-restore.c
+src/modules/module-x11-xsmp.c
+src/modules/module-remap-sink.c
+src/modules/module-bt-proximity.c
+src/modules/module-detect.c
+src/modules/module-always-sink.c
+src/modules/module-lirc.c
+src/modules/module-hal-detect.c
+src/modules/module-sine.c
+src/modules/module-zeroconf-publish.c
+src/modules/module-jack-source.c
+src/modules/module-cli.c
+src/modules/gconf/module-gconf.c
+src/modules/gconf/gconf-helper.c
+src/modules/module-esound-sink.c
+src/modules/module-alsa-sink.c
+src/modules/module-volume-restore.c
+src/modules/module-x11-bell.c
+src/modules/module-protocol-stub.c
+src/modules/module-stream-restore.c
+src/modules/module-jack-sink.c
+src/modules/module-esound-compat-spawnfd.c
+src/modules/module-esound-compat-spawnpid.c
+#src/modules/module-waveout.c
+src/modules/module-combine.c
+src/modules/bt-proximity-helper.c
+src/modules/module-x11-publish.c
+src/modules/rtp/module-rtp-recv.c
+src/modules/rtp/sdp.c
+src/modules/rtp/rtp.c
+src/modules/rtp/sap.c
+src/modules/rtp/module-rtp-send.c
+src/modules/module-ladspa-sink.c
+src/modules/module-suspend-on-idle.c
+src/modules/module-pipe-sink.c
+src/modules/module-null-sink.c
+src/pulsecore/memblock.c
+src/pulsecore/queue.c
+src/pulsecore/core.c
+#src/pulsecore/shmasyncq.c
+src/pulsecore/x11wrap.c
+src/pulsecore/rtclock.c
+src/pulsecore/ioline.c
+src/pulsecore/autoload.c
+src/pulsecore/asyncq.c
+src/pulsecore/mutex-posix.c
+src/pulsecore/protocol-esound.c
+src/pulsecore/proplist-util.c
+src/pulsecore/pstream.c
+src/pulsecore/cli-command.c
+src/pulsecore/ltdl-helper.c
+src/pulsecore/ipacl.c
+src/pulsecore/sample-util.c
+src/pulsecore/log.c
+src/pulsecore/auth-cookie.c
+src/pulsecore/protocol-cli.c
+src/pulsecore/resampler.c
+src/pulsecore/pdispatch.c
+src/pulsecore/hook-list.c
+src/pulsecore/conf-parser.c
+src/pulsecore/mcalign.c
+src/pulsecore/core-subscribe.c
+src/pulsecore/protocol-native.c
+src/pulsecore/source-output.c
+src/pulsecore/modargs.c
+src/pulsecore/core-scache.c
+src/pulsecore/iochannel.c
+src/pulsecore/shared.c
+src/pulsecore/socket-client.c
+src/pulsecore/idxset.c
+src/pulsecore/pipe.c
+src/pulsecore/asyncmsgq.c
+src/pulsecore/inet_pton.c
+src/pulsecore/socket-util.c
+src/pulsecore/object.c
+src/pulsecore/sioman.c
+src/pulsecore/sink-input.c
+src/pulsecore/x11prop.c
+src/pulsecore/sconv-s16be.c
+src/pulsecore/thread-posix.c
+src/pulsecore/client.c
+src/pulsecore/inet_ntop.c
+src/pulsecore/strlist.c
+src/pulsecore/msgobject.c
+src/pulsecore/mutex-win32.c
+src/pulsecore/dynarray.c
+src/pulsecore/rtsig.c
+src/pulsecore/once.c
+src/pulsecore/source.c
+src/pulsecore/memchunk.c
+src/pulsecore/protocol-simple.c
+src/pulsecore/sink.c
+src/pulsecore/sconv-s16le.c
+src/pulsecore/sconv.c
+src/pulsecore/core-error.c
+src/pulsecore/strbuf.c
+src/pulsecore/play-memblockq.c
+src/pulsecore/dllmain.c
+src/pulsecore/envelope.c
+src/pulsecore/pid.c
+src/pulsecore/thread-mq.c
+src/pulsecore/shm.c
+src/pulsecore/play-memchunk.c
+src/pulsecore/hashmap.c
+src/pulsecore/avahi-wrap.c
+src/pulsecore/authkey.c
+src/pulsecore/namereg.c
+src/pulsecore/poll.c
+src/pulsecore/tokenizer.c
+src/pulsecore/semaphore-posix.c
+src/pulsecore/cli-text.c
+src/pulsecore/g711.c
+src/pulsecore/core-util.c
+src/pulsecore/thread-win32.c
+src/pulsecore/tagstruct.c
+src/pulsecore/socket-server.c
+src/pulsecore/flist.c
+src/pulsecore/fdsem.c
+src/pulsecore/random.c
+src/pulsecore/modinfo.c
+src/pulsecore/start-child.c
+src/pulsecore/packet.c
+src/pulsecore/pstream-util.c
+src/pulsecore/rtpoll.c
+src/pulsecore/sound-file.c
+src/pulsecore/module.c
+src/pulsecore/ffmpeg/resample2.c
+src/pulsecore/cli.c
+src/pulsecore/time-smoother.c
+src/pulsecore/parseaddr.c
+src/pulsecore/sound-file-stream.c
+src/pulsecore/memblockq.c
+src/pulsecore/protocol-http.c
+src/pulsecore/semaphore-win32.c
+src/daemon/cpulimit.c
+src/daemon/ltdl-bind-now.c
+src/daemon/polkit.c
+src/daemon/main.c
+src/daemon/cmdline.c
+src/daemon/dumpmodules.c
+src/daemon/daemon-conf.c
+src/daemon/caps.c
+src/pulse/channelmap.c
+src/pulse/error.c
+src/pulse/proplist.c
+src/pulse/xmalloc.c
+src/pulse/ext-stream-restore.c
+src/pulse/stream.c
+src/pulse/i18n.c
+src/pulse/util.c
+src/pulse/utf8.c
+src/pulse/mainloop-api.c
+src/pulse/sample.c
+src/pulse/client-conf-x11.c
+src/pulse/client-conf.c
+src/pulse/browser.c
+src/pulse/volume.c
+src/pulse/simple.c
+src/pulse/subscribe.c
+src/pulse/introspect.c
+src/pulse/mainloop.c
+src/pulse/mainloop-signal.c
+src/pulse/operation.c
+src/pulse/context.c
+src/pulse/thread-mainloop.c
+src/pulse/scache.c
+src/pulse/glib-mainloop.c
+src/pulse/timeval.c
+src/utils/pacat.c
+src/utils/pasuspender.c
+src/utils/pabrowse.c
+src/utils/pactl.c
+src/utils/padsp.c
+src/utils/pax11publish.c
+src/utils/pacmd.c
+src/utils/paplay.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644
index 0000000..4622d2f
--- /dev/null
+++ b/po/POTFILES.skip
@@ -0,0 +1 @@
+src/pulsecore/atomic.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 0fa0c14..ec99831 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,6 +56,7 @@ AM_CFLAGS += -DPA_SYSTEM_RUNTIME_PATH=\"$(PA_SYSTEM_RUNTIME_PATH)\"
AM_CFLAGS += -DPA_SYSTEM_CONFIG_PATH=\"$(PA_SYSTEM_CONFIG_PATH)\"
AM_CFLAGS += -DPA_SYSTEM_STATE_PATH=\"$(PA_SYSTEM_STATE_PATH)\"
AM_CFLAGS += -DAO_REQUIRE_CAS
+AM_CFLAGS += -DPULSE_LOCALEDIR=\"$(pulselocaledir)\"
# This cool debug trap works on i386/gcc only
AM_CFLAGS += '-DDEBUG_TRAP=__asm__("int $$3")'
@@ -532,7 +533,8 @@ libpulse_la_SOURCES = \
pulse/volume.c pulse/volume.h \
pulse/xmalloc.c pulse/xmalloc.h \
pulse/proplist.c pulse/proplist.h \
- pulse/ext-stream-restore.c pulse/ext-stream-restore.h
+ pulse/ext-stream-restore.c pulse/ext-stream-restore.h \
+ pulse/i18n.c pulse/i18n.h
# Internal stuff that is shared with libpulsecore
libpulse_la_SOURCES += \
@@ -727,7 +729,8 @@ libpulsecore_la_SOURCES = \
pulse/util.c pulse/util.h \
pulse/volume.c pulse/volume.h \
pulse/xmalloc.c pulse/xmalloc.h \
- pulse/proplist.c pulse/proplist.h
+ pulse/proplist.c pulse/proplist.h \
+ pulse/i18n.c pulse/i18n.h
# Pure core stuff (some are shared in libpulse though).
libpulsecore_la_SOURCES += \
diff --git a/src/daemon/caps.c b/src/daemon/caps.c
index 8a49e37..f7b6658 100644
--- a/src/daemon/caps.c
+++ b/src/daemon/caps.c
@@ -28,7 +28,12 @@
#include <errno.h>
#include <string.h>
#include <sys/types.h>
+
+#include <pulse/i18n.h>
+
#include <pulsecore/macro.h>
+#include <pulsecore/core-error.h>
+#include <pulsecore/log.h>
#ifdef HAVE_SYS_CAPABILITY_H
#include <sys/capability.h>
@@ -37,10 +42,6 @@
#include <sys/prctl.h>
#endif
-#include <pulsecore/core-error.h>
-
-#include <pulsecore/log.h>
-
#include "caps.h"
/* Glibc <= 2.2 has broken unistd.h */
@@ -58,7 +59,7 @@ void pa_drop_root(void) {
if (uid == 0 || geteuid() != 0)
return;
- pa_log_info("Dropping root priviliges.");
+ pa_log_info(_("Dropping root priviliges."));
#if defined(HAVE_SETRESUID)
pa_assert_se(setresuid(uid, uid, uid) >= 0);
@@ -98,7 +99,7 @@ void pa_limit_caps(void) {
* that */
pa_drop_caps();
else
- pa_log_info("Limited capabilities successfully to CAP_SYS_NICE.");
+ pa_log_info(_("Limited capabilities successfully to CAP_SYS_NICE."));
pa_assert_se(cap_free(caps) == 0);
diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c
index 4b2466c..3121da6 100644
--- a/src/daemon/cmdline.c
+++ b/src/daemon/cmdline.c
@@ -30,6 +30,7 @@
#include <sys/stat.h>
#include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
#include <pulsecore/core-util.h>
#include <pulsecore/strbuf.h>
@@ -111,7 +112,7 @@ void pa_cmdline_help(const char *argv0) {
else
e = argv0;
- printf("%s [options]\n\n"
+ printf(_("%s [options]\n\n"
"COMMANDS:\n"
" -h, --help Show this help\n"
" --version Show version\n"
@@ -160,7 +161,7 @@ void pa_cmdline_help(const char *argv0) {
" -C Open a command line on the running TTY\n"
" after startup\n\n"
- " -n Don't load default script file\n", e);
+ " -n Don't load default script file\n"), e);
}
int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d) {
@@ -237,14 +238,14 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
case ARG_DAEMONIZE:
case 'D':
if ((conf->daemonize = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
- pa_log("--daemonize expects boolean argument");
+ pa_log(_("--daemonize expects boolean argument"));
goto fail;
}
break;
case ARG_FAIL:
if ((conf->fail = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
- pa_log("--fail expects boolean argument");
+ pa_log(_("--fail expects boolean argument"));
goto fail;
}
break;
@@ -254,7 +255,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
if (optarg) {
if (pa_daemon_conf_set_log_level(conf, optarg) < 0) {
- pa_log("--log-level expects log level argument (either numeric in range 0..4 or one of debug, info, notice, warn, error).");
+ pa_log(_("--log-level expects log level argument (either numeric in range 0..4 or one of debug, info, notice, warn, error)."));
goto fail;
}
} else {
@@ -266,28 +267,28 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
case ARG_HIGH_PRIORITY:
if ((conf->high_priority = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
- pa_log("--high-priority expects boolean argument");
+ pa_log(_("--high-priority expects boolean argument"));
goto fail;
}
break;
case ARG_REALTIME:
if ((conf->realtime_scheduling = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
- pa_log("--realtime expects boolean argument");
+ pa_log(_("--realtime expects boolean argument"));
goto fail;
}
break;
case ARG_DISALLOW_MODULE_LOADING:
if ((conf->disallow_module_loading = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
- pa_log("--disallow-module-loading expects boolean argument");
+ pa_log(_("--disallow-module-loading expects boolean argument"));
goto fail;
}
break;
case ARG_USE_PID_FILE:
if ((conf->use_pid_file = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
- pa_log("--use-pid-file expects boolean argument");
+ pa_log(_("--use-pid-file expects boolean argument"));
goto fail;
}
break;
@@ -304,7 +305,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
case ARG_LOG_TARGET:
if (pa_daemon_conf_set_log_target(conf, optarg) < 0) {
- pa_log("Invalid log target: use either 'syslog', 'stderr' or 'auto'.");
+ pa_log(_("Invalid log target: use either 'syslog', 'stderr' or 'auto'."));
goto fail;
}
break;
@@ -323,28 +324,28 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
case ARG_RESAMPLE_METHOD:
if (pa_daemon_conf_set_resample_method(conf, optarg) < 0) {
- pa_log("Invalid resample method '%s'.", optarg);
+ pa_log(_("Invalid resample method '%s'."), optarg);
goto fail;
}
break;
case ARG_SYSTEM:
if ((conf->system_instance = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
- pa_log("--system expects boolean argument");
+ pa_log(_("--system expects boolean argument"));
goto fail;
}
break;
case ARG_NO_CPU_LIMIT:
if ((conf->no_cpu_limit = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
- pa_log("--no-cpu-limit expects boolean argument");
+ pa_log(_("--no-cpu-limit expects boolean argument"));
goto fail;
}
break;
case ARG_DISABLE_SHM:
if ((conf->disable_shm = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) {
- pa_log("--disable-shm expects boolean argument");
+ pa_log(_("--disable-shm expects boolean argument"));
goto fail;
}
break;
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 50b812d..a6b27c5 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -32,6 +32,7 @@
#include <pulse/xmalloc.h>
#include <pulse/timeval.h>
+#include <pulse/i18n.h>
#include <pulsecore/core-error.h>
#include <pulsecore/core-util.h>
@@ -198,7 +199,7 @@ static int parse_log_target(const char *filename, unsigned line, const char *lva
pa_assert(data);
if (pa_daemon_conf_set_log_target(c, rvalue) < 0) {
- pa_log("[%s:%u] Invalid log target '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid log target '%s'."), filename, line, rvalue);
return -1;
}
@@ -214,7 +215,7 @@ static int parse_log_level(const char *filename, unsigned line, const char *lval
pa_assert(data);
if (pa_daemon_conf_set_log_level(c, rvalue) < 0) {
- pa_log("[%s:%u] Invalid log level '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid log level '%s'."), filename, line, rvalue);
return -1;
}
@@ -230,7 +231,7 @@ static int parse_resample_method(const char *filename, unsigned line, const char
pa_assert(data);
if (pa_daemon_conf_set_resample_method(c, rvalue) < 0) {
- pa_log("[%s:%u] Invalid resample method '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid resample method '%s'."), filename, line, rvalue);
return -1;
}
@@ -253,14 +254,14 @@ static int parse_rlimit(const char *filename, unsigned line, const char *lvalue,
} else {
int32_t k;
if (pa_atoi(rvalue, &k) < 0) {
- pa_log("[%s:%u] Invalid rlimit '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid rlimit '%s'."), filename, line, rvalue);
return -1;
}
r->is_set = k >= 0;
r->value = k >= 0 ? (rlim_t) k : 0;
}
#else
- pa_log_warn("[%s:%u] rlimit not supported on this platform.", filename, line);
+ pa_log_warn(_("[%s:%u] rlimit not supported on this platform."), filename, line);
#endif
return 0;
@@ -276,7 +277,7 @@ static int parse_sample_format(const char *filename, unsigned line, const char *
pa_assert(data);
if ((f = pa_parse_sample_format(rvalue)) < 0) {
- pa_log("[%s:%u] Invalid sample format '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid sample format '%s'."), filename, line, rvalue);
return -1;
}
@@ -294,7 +295,7 @@ static int parse_sample_rate(const char *filename, unsigned line, const char *lv
pa_assert(data);
if (pa_atoi(rvalue, &r) < 0 || r > (int32_t) PA_RATE_MAX || r <= 0) {
- pa_log("[%s:%u] Invalid sample rate '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid sample rate '%s'."), filename, line, rvalue);
return -1;
}
@@ -312,7 +313,7 @@ static int parse_sample_channels(const char *filename, unsigned line, const char
pa_assert(data);
if (pa_atoi(rvalue, &n) < 0 || n > (int32_t) PA_CHANNELS_MAX || n <= 0) {
- pa_log("[%s:%u] Invalid sample channels '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid sample channels '%s'."), filename, line, rvalue);
return -1;
}
@@ -330,7 +331,7 @@ static int parse_fragments(const char *filename, unsigned line, const char *lval
pa_assert(data);
if (pa_atoi(rvalue, &n) < 0 || n < 2) {
- pa_log("[%s:%u] Invalid number of fragments '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid number of fragments '%s'."), filename, line, rvalue);
return -1;
}
@@ -348,7 +349,7 @@ static int parse_fragment_size_msec(const char *filename, unsigned line, const c
pa_assert(data);
if (pa_atoi(rvalue, &n) < 0 || n < 1) {
- pa_log("[%s:%u] Invalid fragment size '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid fragment size '%s'."), filename, line, rvalue);
return -1;
}
@@ -366,7 +367,7 @@ static int parse_nice_level(const char *filename, unsigned line, const char *lva
pa_assert(data);
if (pa_atoi(rvalue, &level) < 0 || level < -20 || level > 19) {
- pa_log("[%s:%u] Invalid nice level '%s'.", filename, line, rvalue);
+ pa_log(_("[%s:%u] Invalid nice level '%s'."), filename, line, rvalue);
return -1;
}
@@ -557,7 +558,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
pa_open_config_file(DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_FILE_USER, ENV_CONFIG_FILE, &c->config_file);
if (!f && errno != ENOENT) {
- pa_log_warn("Failed to open configuration file: %s", pa_cstrerror(errno));
+ pa_log_warn(_("Failed to open configuration file: %s"), pa_cstrerror(errno));
goto finish;
}
@@ -631,7 +632,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
s = pa_strbuf_new();
if (c->config_file)
- pa_strbuf_printf(s, "### Read from configuration file: %s ###\n", c->config_file);
+ pa_strbuf_printf(s, _("### Read from configuration file: %s ###\n"), c->config_file);
pa_assert(c->log_level <= PA_LOG_LEVEL_MAX);
diff --git a/src/daemon/dumpmodules.c b/src/daemon/dumpmodules.c
index cd6866a..26fb8ee 100644
--- a/src/daemon/dumpmodules.c
+++ b/src/daemon/dumpmodules.c
@@ -30,6 +30,7 @@
#include <ltdl.h>
#include <pulse/util.h>
+#include <pulse/i18n.h>
#include <pulsecore/modinfo.h>
#include <pulsecore/core-util.h>
@@ -56,24 +57,24 @@ static void long_info(const char *name, const char *path, pa_modinfo *i) {
nl = 1;
- printf("Name: %s\n", name);
+ printf(_("Name: %s\n"), name);
if (!i->description && !i->version && !i->author && !i->usage)
- printf("No module information available\n");
+ printf(_("No module information available\n"));
else {
if (i->version)
- printf("Version: %s\n", i->version);
+ printf(_("Version: %s\n"), i->version);
if (i->description)
- printf("Description: %s\n", i->description);
+ printf(_("Description: %s\n"), i->description);
if (i->author)
- printf("Author: %s\n", i->author);
+ printf(_("Author: %s\n"), i->author);
if (i->usage)
- printf("Usage: %s\n", i->usage);
- printf("Load Once: %s\n", pa_yes_no(i->load_once));
+ printf(_("Usage: %s\n"), i->usage);
+ printf(_("Load Once: %s\n"), pa_yes_no(i->load_once));
}
if (path)
- printf("Path: %s\n", path);
+ printf(_("Path: %s\n"), path);
}
static void show_info(const char *name, const char *path, void (*info)(const char *name, const char *path, pa_modinfo*i)) {
diff --git a/src/daemon/ltdl-bind-now.c b/src/daemon/ltdl-bind-now.c
index b177067..4007724 100644
--- a/src/daemon/ltdl-bind-now.c
+++ b/src/daemon/ltdl-bind-now.c
@@ -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
}
-
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 5fc9f01..2579c18 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -64,6 +64,7 @@
#include <pulse/mainloop-signal.h>
#include <pulse/timeval.h>
#include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
#include <pulsecore/winsock.h>
#include <pulsecore/core-error.h>
@@ -131,7 +132,7 @@ static void message_cb(pa_mainloop_api*a, pa_time_event*e, PA_GCC_UNUSED const s
#endif
static void signal_callback(pa_mainloop_api*m, PA_GCC_UNUSED pa_signal_event *e, int sig, void *userdata) {
- pa_log_info("Got signal %s.", pa_sig2str(sig));
+ pa_log_info(_("Got signal %s."), pa_sig2str(sig));
switch (sig) {
#ifdef SIGUSR1
@@ -158,7 +159,7 @@ static void signal_callback(pa_mainloop_api*m, PA_GCC_UNUSED pa_signal_event *e,
case SIGINT:
case SIGTERM:
default:
- pa_log_info("Exiting.");
+ pa_log_info(_("Exiting."));
m->quit(m, 1);
break;
}
@@ -176,41 +177,41 @@ static int change_user(void) {
* afterwards. */
if (!(pw = getpwnam(PA_SYSTEM_USER))) {
- pa_log("Failed to find user '%s'.", PA_SYSTEM_USER);
+ pa_log(_("Failed to find user '%s'."), PA_SYSTEM_USER);
return -1;
}
if (!(gr = getgrnam(PA_SYSTEM_GROUP))) {
- pa_log("Failed to find group '%s'.", PA_SYSTEM_GROUP);
+ pa_log(_("Failed to find group '%s'."), PA_SYSTEM_GROUP);
return -1;
}
- pa_log_info("Found user '%s' (UID %lu) and group '%s' (GID %lu).",
+ pa_log_info(_("Found user '%s' (UID %lu) and group '%s' (GID %lu)."),
PA_SYSTEM_USER, (unsigned long) pw->pw_uid,
PA_SYSTEM_GROUP, (unsigned long) gr->gr_gid);
if (pw->pw_gid != gr->gr_gid) {
- pa_log("GID of user '%s' and of group '%s' don't match.", PA_SYSTEM_USER, PA_SYSTEM_GROUP);
+ pa_log(_("GID of user '%s' and of group '%s' don't match."), PA_SYSTEM_USER, PA_SYSTEM_GROUP);
return -1;
}
if (strcmp(pw->pw_dir, PA_SYSTEM_RUNTIME_PATH) != 0)
- pa_log_warn("Warning: home directory of user '%s' is not '%s', ignoring.", PA_SYSTEM_USER, PA_SYSTEM_RUNTIME_PATH);
+ pa_log_warn(_("Home directory of user '%s' is not '%s', ignoring."), PA_SYSTEM_USER, PA_SYSTEM_RUNTIME_PATH);
if (pa_make_secure_dir(PA_SYSTEM_RUNTIME_PATH, 0755, pw->pw_uid, gr->gr_gid) < 0) {
- pa_log("Failed to create '%s': %s", PA_SYSTEM_RUNTIME_PATH, pa_cstrerror(errno));
+ pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_RUNTIME_PATH, pa_cstrerror(errno));
return -1;
}
if (pa_make_secure_dir(PA_SYSTEM_STATE_PATH, 0700, pw->pw_uid, gr->gr_gid) < 0) {
- pa_log("Failed to create '%s': %s", PA_SYSTEM_STATE_PATH, pa_cstrerror(errno));
+ pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_STATE_PATH, pa_cstrerror(errno));
return -1;
}
/* We don't create the config dir here, because we don't need to write to it */
if (initgroups(PA_SYSTEM_USER, gr->gr_gid) != 0) {
- pa_log("Failed to change group list: %s", pa_cstrerror(errno));
+ pa_log(_("Failed to change group list: %s"), pa_cstrerror(errno));
return -1;
}
@@ -226,7 +227,7 @@ static int change_user(void) {
#endif
if (r < 0) {
- pa_log("Failed to change GID: %s", pa_cstrerror(errno));
+ pa_log(_("Failed to change GID: %s"), pa_cstrerror(errno));
return -1;
}
@@ -242,7 +243,7 @@ static int change_user(void) {
#endif
if (r < 0) {
- pa_log("Failed to change UID: %s", pa_cstrerror(errno));
+ pa_log(_("Failed to change UID: %s"), pa_cstrerror(errno));
return -1;
}
@@ -256,7 +257,7 @@ static int change_user(void) {
pa_set_env("PULSE_CONFIG_PATH", PA_SYSTEM_CONFIG_PATH);
pa_set_env("PULSE_STATE_PATH", PA_SYSTEM_STATE_PATH);
- pa_log_info("Successfully dropped root privileges.");
+ pa_log_info(_("Successfully dropped root privileges."));
return 0;
}
@@ -264,7 +265,7 @@ static int change_user(void) {
#else /* HAVE_PWD_H && HAVE_GRP_H */
static int change_user(void) {
- pa_log("System wide mode unsupported on this platform.");
+ pa_log(_("System wide mode unsupported on this platform."));
return -1;
}
@@ -282,7 +283,7 @@ static int set_one_rlimit(const pa_rlimit *r, int resource, const char *name) {
rl.rlim_cur = rl.rlim_max = r->value;
if (setrlimit(resource, &rl) < 0) {
- pa_log_info("setrlimit(%s, (%u, %u)) failed: %s", name, (unsigned) r->value, (unsigned) r->value, pa_cstrerror(errno));
+ pa_log_info(_("setrlimit(%s, (%u, %u)) failed: %s"), name, (unsigned) r->value, (unsigned) r->value, pa_cstrerror(errno));
return -1;
}
@@ -407,6 +408,8 @@ int main(int argc, char *argv[]) {
* still are normal root. */
setlocale(LC_ALL, "");
+ pa_init_i18n();
+
pa_log_set_maximal_level(PA_LOG_INFO);
pa_log_set_ident("pulseaudio");
@@ -419,7 +422,7 @@ int main(int argc, char *argv[]) {
goto finish;
if (pa_cmdline_parse(conf, argc, argv, &d) < 0) {
- pa_log("Failed to parse command line.");
+ pa_log(_("Failed to parse command line."));
goto finish;
}
@@ -435,14 +438,14 @@ int main(int argc, char *argv[]) {
if (conf->high_priority && !allow_high_priority) {
if (pa_own_uid_in_group(PA_REALTIME_GROUP, &gid) > 0) {
- pa_log_info("We're in the group '"PA_REALTIME_GROUP"', allowing high-priority scheduling.");
+ pa_log_info(_("We're in the group '%s', allowing high-priority scheduling."), PA_REALTIME_GROUP);
allow_high_priority = TRUE;
}
}
if (conf->realtime_scheduling && !allow_realtime) {
if (pa_own_uid_in_group(PA_REALTIME_GROUP, &gid) > 0) {
- pa_log_info("We're in the group '"PA_REALTIME_GROUP"', allowing real-time scheduling.");
+ pa_log_info(_("We're in the group '%s', allowing real-time scheduling."), PA_REALTIME_GROUP);
allow_realtime = TRUE;
}
}
@@ -450,18 +453,18 @@ int main(int argc, char *argv[]) {
#ifdef HAVE_POLKIT
if (conf->high_priority && !allow_high_priority) {
if (pa_polkit_check("org.pulseaudio.acquire-high-priority") > 0) {
- pa_log_info("PolicyKit grants us acquire-high-priority privilege.");
+ pa_log_info(_("PolicyKit grants us acquire-high-priority privilege."));
allow_high_priority = TRUE;
} else
- pa_log_info("PolicyKit refuses acquire-high-priority privilege.");
+ pa_log_info(_("PolicyKit refuses acquire-high-priority privilege."));
}
if (conf->realtime_scheduling && !allow_realtime) {
if (pa_polkit_check("org.pulseaudio.acquire-real-time") > 0) {
- pa_log_info("PolicyKit grants us acquire-real-time privilege.");
+ pa_log_info(_("PolicyKit grants us acquire-real-time privilege."));
allow_realtime = TRUE;
} else
- pa_log_info("PolicyKit refuses acquire-real-time privilege.");
+ pa_log_info(_("PolicyKit refuses acquire-real-time privilege."));
}
#endif
@@ -473,9 +476,9 @@ int main(int argc, char *argv[]) {
pa_drop_caps();
if (conf->high_priority || conf->realtime_scheduling)
- pa_log_notice("Called SUID root and real-time/high-priority scheduling was requested in the configuration. However, we lack the necessary priviliges:\n"
- "We are not in group '"PA_REALTIME_GROUP"' and PolicyKit refuse to grant us priviliges. Dropping SUID again.\n"
- "For enabling real-time scheduling please acquire the appropriate PolicyKit priviliges, or become a member of '"PA_REALTIME_GROUP"', or increase the RLIMIT_NICE/RLIMIT_RTPRIO resource limits for this user.");
+ pa_log_notice(_("Called SUID root and real-time/high-priority scheduling was requested in the configuration. However, we lack the necessary priviliges:\n"
+ "We are not in group '"PA_REALTIME_GROUP"' and PolicyKit refuse to grant us priviliges. Dropping SUID again.\n"
+ "For enabling real-time scheduling please acquire the appropriate PolicyKit priviliges, or become a member of '"PA_REALTIME_GROUP"', or increase the RLIMIT_NICE/RLIMIT_RTPRIO resource limits for this user."));
}
}
@@ -491,7 +494,7 @@ int main(int argc, char *argv[]) {
#endif
if (conf->high_priority && !pa_can_high_priority())
- pa_log_warn("High-priority scheduling enabled in configuration but not allowed by policy.");
+ pa_log_warn(_("High-priority scheduling enabled in configuration but not allowed by policy."));
if (conf->high_priority && (conf->cmd == PA_CMD_DAEMON || conf->cmd == PA_CMD_START))
pa_raise_priority(conf->nice_level);
@@ -516,24 +519,24 @@ int main(int argc, char *argv[]) {
rl.rlim_max = rl.rlim_cur = 9;
if (setrlimit(RLIMIT_RTPRIO, &rl) >= 0) {
- pa_log_info("Successfully increased RLIMIT_RTPRIO");
+ pa_log_info(_("Successfully increased RLIMIT_RTPRIO"));
drop = TRUE;
} else
- pa_log_warn("RLIMIT_RTPRIO failed: %s", pa_cstrerror(errno));
+ pa_log_warn(_("RLIMIT_RTPRIO failed: %s"), pa_cstrerror(errno));
}
}
}
#endif
if (drop) {
- pa_log_info("Giving up CAP_NICE");
+ pa_log_info(_("Giving up CAP_NICE"));
pa_drop_caps();
suid_root = FALSE;
}
}
if (conf->realtime_scheduling && !pa_can_realtime())
- pa_log_warn("Real-time scheduling enabled in configuration but not allowed by policy.");
+ pa_log_warn(_("Real-time scheduling enabled in configuration but not allowed by policy."));
pa_log_debug("Can realtime: %s, can high-priority: %s", pa_yes_no(pa_can_realtime()), pa_yes_no(pa_can_high_priority()));
@@ -591,9 +594,9 @@ int main(int argc, char *argv[]) {
pid_t pid;
if (pa_pid_file_check_running(&pid, "pulseaudio") < 0)
- pa_log_info("Daemon not running");
+ pa_log_info(_("Daemon not running"));
else {
- pa_log_info("Daemon running as PID %u", pid);
+ pa_log_info(_("Daemon running as PID %u"), pid);
retval = 0;
}
@@ -603,7 +606,7 @@ int main(int argc, char *argv[]) {
case PA_CMD_KILL:
if (pa_pid_file_kill(SIGINT, NULL, "pulseaudio") < 0)
- pa_log("Failed to kill daemon.");
+ pa_log(_("Failed to kill daemon."));
else
retval = 0;
@@ -621,14 +624,14 @@ int main(int argc, char *argv[]) {
}
if (real_root && !conf->system_instance)
- pa_log_warn("This program is not intended to be run as root (unless --system is specified).");
+ pa_log_warn(_("This program is not intended to be run as root (unless --system is specified)."));
else if (!real_root && conf->system_instance) {
- pa_log("Root priviliges required.");
+ pa_log(_("Root priviliges required."));
goto finish;
}
if (conf->cmd == PA_CMD_START && conf->system_instance) {
- pa_log("--start not supported for system instances.");
+ pa_log(_("--start not supported for system instances."));
goto finish;
}
@@ -646,18 +649,18 @@ int main(int argc, char *argv[]) {
int tty_fd;
if (pa_stdio_acquire() < 0) {
- pa_log("Failed to acquire stdio.");
+ pa_log(_("Failed to acquire stdio."));
goto finish;
}
#ifdef HAVE_FORK
if (pipe(daemon_pipe) < 0) {
- pa_log("pipe failed: %s", pa_cstrerror(errno));
+ pa_log(_("pipe failed: %s"), pa_cstrerror(errno));
goto finish;
}
if ((child = fork()) < 0) {
- pa_log("fork() failed: %s", pa_cstrerror(errno));
+ pa_log(_("fork() failed: %s"), pa_cstrerror(errno));
goto finish;
}
@@ -671,15 +674,15 @@ int main(int argc, char *argv[]) {
if ((n = pa_loop_read(daemon_pipe[0], &retval, sizeof(retval), NULL)) != sizeof(retval)) {
if (n < 0)
- pa_log("read() failed: %s", pa_cstrerror(errno));
+ pa_log(_("read() failed: %s"), pa_cstrerror(errno));
retval = 1;
}
if (retval)
- pa_log("Daemon startup failed.");
+ pa_log(_("Daemon startup failed."));
else
- pa_log_info("Daemon startup successful.");
+ pa_log_info(_("Daemon startup successful."));
goto finish;
}
@@ -746,17 +749,17 @@ int main(int argc, char *argv[]) {
pa_set_env("PULSE_SYSTEM", conf->system_instance ? "1" : "0");
- pa_log_info("This is PulseAudio " PACKAGE_VERSION);
- pa_log_info("Page size is %lu bytes", (unsigned long) PA_PAGE_SIZE);
+ pa_log_info(_("This is PulseAudio %s"), PACKAGE_VERSION);
+ pa_log_info(_("Page size is %lu bytes"), (unsigned long) PA_PAGE_SIZE);
if (!(s = pa_get_runtime_dir()))
goto finish;
- pa_log_info("Using runtime directory %s.", s);
+ pa_log_info(_("Using runtime directory %s."), s);
pa_xfree(s);
if (!(s = pa_get_state_dir()))
- pa_log_info("Using state directory %s.", s);
+ pa_log_info(_("Using state directory %s."), s);
pa_xfree(s);
- pa_log_info("Running in system mode: %s", pa_yes_no(pa_in_system_mode()));
+ pa_log_info(_("Running in system mode: %s"), pa_yes_no(pa_in_system_mode()));
if (conf->use_pid_file) {
int z;
@@ -771,7 +774,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- pa_log("pa_pid_file_create() failed.");
+ pa_log(_("pa_pid_file_create() failed."));
goto finish;
}
@@ -783,9 +786,9 @@ int main(int argc, char *argv[]) {
#endif
if (pa_rtclock_hrtimer())
- pa_log_info("Fresh high-resolution timers available! Bon appetit!");
+ pa_log_info(_("Fresh high-resolution timers available! Bon appetit!"));
else
- pa_log_info("Dude, your kernel stinks! The chef's recommendation today is Linux with high-resolution timers enabled!");
+ pa_log_info(_("Dude, your kernel stinks! The chef's recommendation today is Linux with high-resolution timers enabled!"));
#ifdef SIGRTMIN
/* Valgrind uses SIGRTMAX. To easy debugging we don't use it here */
@@ -795,7 +798,7 @@ int main(int argc, char *argv[]) {
pa_assert_se(mainloop = pa_mainloop_new());
if (!(c = pa_core_new(pa_mainloop_get_api(mainloop), !conf->disable_shm))) {
- pa_log("pa_core_new() failed.");
+ pa_log(_("pa_core_new() failed."));
goto finish;
}
@@ -854,17 +857,17 @@ int main(int argc, char *argv[]) {
c->disallow_module_loading = !!conf->disallow_module_loading;
if (r < 0 && conf->fail) {
- pa_log("Failed to initialize daemon.");
+ pa_log(_("Failed to initialize daemon."));
goto finish;
}
if (!c->modules || pa_idxset_size(c->modules) == 0) {
- pa_log("Daemon startup without any loaded modules, refusing to work.");
+ pa_log(_("Daemon startup without any loaded modules, refusing to work."));
goto finish;
}
if (c->default_sink_name && !pa_namereg_get(c, c->default_sink_name, PA_NAMEREG_SINK, TRUE) && conf->fail) {
- pa_log_error("Default sink name (%s) does not exist in name register.", c->default_sink_name);
+ pa_log_error(_("Default sink name (%s) does not exist in name register."), c->default_sink_name);
goto finish;
}
@@ -877,13 +880,13 @@ int main(int argc, char *argv[]) {
}
#endif
- pa_log_info("Daemon startup complete.");
+ pa_log_info(_("Daemon startup complete."));
retval = 0;
if (pa_mainloop_run(mainloop, &retval) < 0)
goto finish;
- pa_log_info("Daemon shutdown initiated.");
+ pa_log_info(_("Daemon shutdown initiated."));
finish:
@@ -900,7 +903,7 @@ finish:
if (c) {
pa_core_unref(c);
- pa_log_info("Daemon terminated.");
+ pa_log_info(_("Daemon terminated."));
}
if (!conf->no_cpu_limit)
diff --git a/src/daemon/polkit.c b/src/daemon/polkit.c
index 08155cf..921e5d1 100644
--- a/src/daemon/polkit.c
+++ b/src/daemon/polkit.c
@@ -31,6 +31,8 @@
#include <dbus/dbus.h>
#include <polkit-dbus/polkit-dbus.h>
+#include <pulse/i18n.h>
+
#include <pulsecore/log.h>
#include <pulsecore/macro.h>
@@ -50,7 +52,7 @@ int pa_polkit_check(const char *action_id) {
dbus_error_init(&dbus_error);
if (!(bus = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error))) {
- pa_log_error("Cannot connect to system bus: %s", dbus_error.message);
+ pa_log_error(_("Cannot connect to system bus: %s"), dbus_error.message);
goto finish;
}
@@ -60,7 +62,7 @@ int pa_polkit_check(const char *action_id) {
dbus_connection_set_exit_on_disconnect(bus, FALSE);
if (!(caller = polkit_caller_new_from_pid(bus, getpid(), &dbus_error))) {
- pa_log_error("Cannot get caller from PID: %s", dbus_error.message);
+ pa_log_error(_("Cannot get caller from PID: %s"), dbus_error.message);
goto finish;
}
@@ -72,12 +74,12 @@ int pa_polkit_check(const char *action_id) {
* -- an not the EUID or any other user id. */
if (!(polkit_caller_set_uid(caller, getuid()))) {
- pa_log_error("Cannot set UID on caller object.");
+ pa_log_error(_("Cannot set UID on caller object."));
goto finish;
}
if (!(polkit_caller_get_ck_session(caller, &session))) {
- pa_log_error("Failed to get CK session.");
+ pa_log_error(_("Failed to get CK session."));
goto finish;
}
@@ -85,27 +87,27 @@ int pa_polkit_check(const char *action_id) {
* object */
if (!(polkit_session_set_uid(session, getuid()))) {
- pa_log_error("Cannot set UID on session object.");
+ pa_log_error(_("Cannot set UID on session object."));
goto finish;
}
if (!(action = polkit_action_new())) {
- pa_log_error("Cannot allocate PolKitAction.");
+ pa_log_error(_("Cannot allocate PolKitAction."));
goto finish;
}
if (!polkit_action_set_action_id(action, action_id)) {
- pa_log_error("Cannot set action_id");
+ pa_log_error(_("Cannot set action_id"));
goto finish;
}
if (!(context = polkit_context_new())) {
- pa_log_error("Cannot allocate PolKitContext.");
+ pa_log_error(_("Cannot allocate PolKitContext."));
goto finish;
}
if (!polkit_context_init(context, &polkit_error)) {
- pa_log_error("Cannot initialize PolKitContext: %s", polkit_error_get_error_message(polkit_error));
+ pa_log_error(_("Cannot initialize PolKitContext: %s"), polkit_error_get_error_message(polkit_error));
goto finish;
}
@@ -114,7 +116,7 @@ int pa_polkit_check(const char *action_id) {
polkit_result = polkit_context_is_caller_authorized(context, action, caller, TRUE, &polkit_error);
if (polkit_error_is_set(polkit_error)) {
- pa_log_error("Could not determine whether caller is authorized: %s", polkit_error_get_error_message(polkit_error));
+ pa_log_error(_("Could not determine whether caller is authorized: %s"), polkit_error_get_error_message(polkit_error));
goto finish;
}
@@ -134,7 +136,7 @@ int pa_polkit_check(const char *action_id) {
}
if (dbus_error_is_set(&dbus_error)) {
- pa_log_error("Cannot obtain auth: %s", dbus_error.message);
+ pa_log_error(_("Cannot obtain auth: %s"), dbus_error.message);
goto finish;
}
}
@@ -143,7 +145,7 @@ int pa_polkit_check(const char *action_id) {
}
if (polkit_result != POLKIT_RESULT_YES && polkit_result != POLKIT_RESULT_NO)
- pa_log_warn("PolicyKit responded with '%s'", polkit_result_to_string_representation(polkit_result));
+ pa_log_warn(_("PolicyKit responded with '%s'"), polkit_result_to_string_representation(polkit_result));
ret = polkit_result == POLKIT_RESULT_YES;
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 7348b32..084e75b 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
#include <pulsecore/core-util.h>
#include <pulsecore/macro.h>
@@ -98,66 +99,66 @@ const char *const table[PA_CHANNEL_POSITION_MAX] = {
};
const char *const pretty_table[PA_CHANNEL_POSITION_MAX] = {
- [PA_CHANNEL_POSITION_MONO] = "Mono",
-
- [PA_CHANNEL_POSITION_FRONT_CENTER] = "Front Center",
- [PA_CHANNEL_POSITION_FRONT_LEFT] = "Front Left",
- [PA_CHANNEL_POSITION_FRONT_RIGHT] = "Front Right",
-
- [PA_CHANNEL_POSITION_REAR_CENTER] = "Rear Center",
- [PA_CHANNEL_POSITION_REAR_LEFT] = "Rear Left",
- [PA_CHANNEL_POSITION_REAR_RIGHT] = "Rear Right",
-
- [PA_CHANNEL_POSITION_LFE] = "Low Frequency Emmiter",
-
- [PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER] = "Front Left-of-center",
- [PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER] = "Front Right-of-center",
-
- [PA_CHANNEL_POSITION_SIDE_LEFT] = "Side Left",
- [PA_CHANNEL_POSITION_SIDE_RIGHT] = "Side Right",
-
- [PA_CHANNEL_POSITION_AUX0] = "Auxiliary 0",
- [PA_CHANNEL_POSITION_AUX1] = "Auxiliary 1",
- [PA_CHANNEL_POSITION_AUX2] = "Auxiliary 2",
- [PA_CHANNEL_POSITION_AUX3] = "Auxiliary 3",
- [PA_CHANNEL_POSITION_AUX4] = "Auxiliary 4",
- [PA_CHANNEL_POSITION_AUX5] = "Auxiliary 5",
- [PA_CHANNEL_POSITION_AUX6] = "Auxiliary 6",
- [PA_CHANNEL_POSITION_AUX7] = "Auxiliary 7",
- [PA_CHANNEL_POSITION_AUX8] = "Auxiliary 8",
- [PA_CHANNEL_POSITION_AUX9] = "Auxiliary 9",
- [PA_CHANNEL_POSITION_AUX10] = "Auxiliary 10",
- [PA_CHANNEL_POSITION_AUX11] = "Auxiliary 11",
- [PA_CHANNEL_POSITION_AUX12] = "Auxiliary 12",
- [PA_CHANNEL_POSITION_AUX13] = "Auxiliary 13",
- [PA_CHANNEL_POSITION_AUX14] = "Auxiliary 14",
- [PA_CHANNEL_POSITION_AUX15] = "Auxiliary 15",
- [PA_CHANNEL_POSITION_AUX16] = "Auxiliary 16",
- [PA_CHANNEL_POSITION_AUX17] = "Auxiliary 17",
- [PA_CHANNEL_POSITION_AUX18] = "Auxiliary 18",
- [PA_CHANNEL_POSITION_AUX19] = "Auxiliary 19",
- [PA_CHANNEL_POSITION_AUX20] = "Auxiliary 20",
- [PA_CHANNEL_POSITION_AUX21] = "Auxiliary 21",
- [PA_CHANNEL_POSITION_AUX22] = "Auxiliary 22",
- [PA_CHANNEL_POSITION_AUX23] = "Auxiliary 23",
- [PA_CHANNEL_POSITION_AUX24] = "Auxiliary 24",
- [PA_CHANNEL_POSITION_AUX25] = "Auxiliary 25",
- [PA_CHANNEL_POSITION_AUX26] = "Auxiliary 26",
- [PA_CHANNEL_POSITION_AUX27] = "Auxiliary 27",
- [PA_CHANNEL_POSITION_AUX28] = "Auxiliary 28",
- [PA_CHANNEL_POSITION_AUX29] = "Auxiliary 29",
- [PA_CHANNEL_POSITION_AUX30] = "Auxiliary 30",
- [PA_CHANNEL_POSITION_AUX31] = "Auxiliary 31",
-
- [PA_CHANNEL_POSITION_TOP_CENTER] = "Top Center",
-
- [PA_CHANNEL_POSITION_TOP_FRONT_CENTER] = "Top Front Center",
- [PA_CHANNEL_POSITION_TOP_FRONT_LEFT] = "Top Front Left",
- [PA_CHANNEL_POSITION_TOP_FRONT_RIGHT] = "Top Front Right",
-
- [PA_CHANNEL_POSITION_TOP_REAR_CENTER] = "Top Rear Center",
- [PA_CHANNEL_POSITION_TOP_REAR_LEFT] = "Top Rear left",
- [PA_CHANNEL_POSITION_TOP_REAR_RIGHT] = "Top Rear Right"
+ [PA_CHANNEL_POSITION_MONO] = N_("Mono"),
+
+ [PA_CHANNEL_POSITION_FRONT_CENTER] = N_("Front Center"),
+ [PA_CHANNEL_POSITION_FRONT_LEFT] = N_("Front Left"),
+ [PA_CHANNEL_POSITION_FRONT_RIGHT] = N_("Front Right"),
+
+ [PA_CHANNEL_POSITION_REAR_CENTER] = N_("Rear Center"),
+ [PA_CHANNEL_POSITION_REAR_LEFT] = N_("Rear Left"),
+ [PA_CHANNEL_POSITION_REAR_RIGHT] = N_("Rear Right"),
+
+ [PA_CHANNEL_POSITION_LFE] = N_("Low Frequency Emmiter"),
+
+ [PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER] = N_("Front Left-of-center"),
+ [PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER] = N_("Front Right-of-center"),
+
+ [PA_CHANNEL_POSITION_SIDE_LEFT] = N_("Side Left"),
+ [PA_CHANNEL_POSITION_SIDE_RIGHT] = N_("Side Right"),
+
+ [PA_CHANNEL_POSITION_AUX0] = N_("Auxiliary 0"),
+ [PA_CHANNEL_POSITION_AUX1] = N_("Auxiliary 1"),
+ [PA_CHANNEL_POSITION_AUX2] = N_("Auxiliary 2"),
+ [PA_CHANNEL_POSITION_AUX3] = N_("Auxiliary 3"),
+ [PA_CHANNEL_POSITION_AUX4] = N_("Auxiliary 4"),
+ [PA_CHANNEL_POSITION_AUX5] = N_("Auxiliary 5"),
+ [PA_CHANNEL_POSITION_AUX6] = N_("Auxiliary 6"),
+ [PA_CHANNEL_POSITION_AUX7] = N_("Auxiliary 7"),
+ [PA_CHANNEL_POSITION_AUX8] = N_("Auxiliary 8"),
+ [PA_CHANNEL_POSITION_AUX9] = N_("Auxiliary 9"),
+ [PA_CHANNEL_POSITION_AUX10] = N_("Auxiliary 10"),
+ [PA_CHANNEL_POSITION_AUX11] = N_("Auxiliary 11"),
+ [PA_CHANNEL_POSITION_AUX12] = N_("Auxiliary 12"),
+ [PA_CHANNEL_POSITION_AUX13] = N_("Auxiliary 13"),
+ [PA_CHANNEL_POSITION_AUX14] = N_("Auxiliary 14"),
+ [PA_CHANNEL_POSITION_AUX15] = N_("Auxiliary 15"),
+ [PA_CHANNEL_POSITION_AUX16] = N_("Auxiliary 16"),
+ [PA_CHANNEL_POSITION_AUX17] = N_("Auxiliary 17"),
+ [PA_CHANNEL_POSITION_AUX18] = N_("Auxiliary 18"),
+ [PA_CHANNEL_POSITION_AUX19] = N_("Auxiliary 19"),
+ [PA_CHANNEL_POSITION_AUX20] = N_("Auxiliary 20"),
+ [PA_CHANNEL_POSITION_AUX21] = N_("Auxiliary 21"),
+ [PA_CHANNEL_POSITION_AUX22] = N_("Auxiliary 22"),
+ [PA_CHANNEL_POSITION_AUX23] = N_("Auxiliary 23"),
+ [PA_CHANNEL_POSITION_AUX24] = N_("Auxiliary 24"),
+ [PA_CHANNEL_POSITION_AUX25] = N_("Auxiliary 25"),
+ [PA_CHANNEL_POSITION_AUX26] = N_("Auxiliary 26"),
+ [PA_CHANNEL_POSITION_AUX27] = N_("Auxiliary 27"),
+ [PA_CHANNEL_POSITION_AUX28] = N_("Auxiliary 28"),
+ [PA_CHANNEL_POSITION_AUX29] = N_("Auxiliary 29"),
+ [PA_CHANNEL_POSITION_AUX30] = N_("Auxiliary 30"),
+ [PA_CHANNEL_POSITION_AUX31] = N_("Auxiliary 31"),
+
+ [PA_CHANNEL_POSITION_TOP_CENTER] = N_("Top Center"),
+
+ [PA_CHANNEL_POSITION_TOP_FRONT_CENTER] = N_("Top Front Center"),
+ [PA_CHANNEL_POSITION_TOP_FRONT_LEFT] = N_("Top Front Left"),
+ [PA_CHANNEL_POSITION_TOP_FRONT_RIGHT] = N_("Top Front Right"),
+
+ [PA_CHANNEL_POSITION_TOP_REAR_CENTER] = N_("Top Rear Center"),
+ [PA_CHANNEL_POSITION_TOP_REAR_LEFT] = N_("Top Rear left"),
+ [PA_CHANNEL_POSITION_TOP_REAR_RIGHT] = N_("Top Rear Right")
};
pa_channel_map* pa_channel_map_init(pa_channel_map *m) {
@@ -432,10 +433,13 @@ const char* pa_channel_position_to_string(pa_channel_position_t pos) {
}
const char* pa_channel_position_to_pretty_string(pa_channel_position_t pos) {
+
+ pa_init_i18n();
+
if (pos < 0 || pos >= PA_CHANNEL_POSITION_MAX)
return NULL;
- return pretty_table[pos];
+ return _(pretty_table[pos]);
}
int pa_channel_map_equal(const pa_channel_map *a, const pa_channel_map *b) {
@@ -552,7 +556,6 @@ int pa_channel_map_valid(const pa_channel_map *map) {
if (map->map[c] < 0 ||map->map[c] >= PA_CHANNEL_POSITION_MAX)
return 0;
-
}
return 1;
diff --git a/src/pulse/client-conf-x11.c b/src/pulse/client-conf-x11.c
index 393a7cd..a8a90fb 100644
--- a/src/pulse/client-conf-x11.c
+++ b/src/pulse/client-conf-x11.c
@@ -29,6 +29,7 @@
#include <X11/Xatom.h>
#include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
#include <pulsecore/x11prop.h>
#include <pulsecore/log.h>
@@ -51,7 +52,7 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
goto finish;
if (!(d = XOpenDisplay(dname))) {
- pa_log("XOpenDisplay() failed");
+ pa_log(_("XOpenDisplay() failed"));
goto finish;
}
@@ -74,7 +75,7 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
if (pa_parsehex(t, cookie, sizeof(cookie)) != sizeof(cookie)) {
- pa_log("failed to parse cookie data");
+ pa_log(_("Failed to parse cookie data"));
goto finish;
}
diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
index 915d0cc..739ef16 100644
--- a/src/pulse/client-conf.c
+++ b/src/pulse/client-conf.c
@@ -30,6 +30,7 @@
#include <string.h>
#include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
#include <pulsecore/macro.h>
#include <pulsecore/core-error.h>
@@ -113,7 +114,7 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) {
if (filename) {
if (!(f = fopen(filename, "r"))) {
- pa_log("Failed to open configuration file '%s': %s", fn, pa_cstrerror(errno));
+ pa_log(_("Failed to open configuration file '%s': %s"), fn, pa_cstrerror(errno));
goto finish;
}
diff --git a/src/pulse/context.c b/src/pulse/context.c
index f7b3296..5be4078 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -53,6 +53,7 @@
#include <pulse/xmalloc.h>
#include <pulse/utf8.h>
#include <pulse/util.h>
+#include <pulse/i18n.h>
#include <pulsecore/winsock.h>
#include <pulsecore/core-error.h>
@@ -106,7 +107,7 @@ static void unlock_autospawn_lock_file(pa_context *c) {
char *lf;
if (!(lf = pa_runtime_path(AUTOSPAWN_LOCK)))
- pa_log_warn("Cannot unlock autospawn because runtime path is no more.");
+ pa_log_warn(_("Cannot unlock autospawn because runtime path is no more."));
pa_unlock_lockfile(lf, c->autospawn_lock_fd);
pa_xfree(lf);
@@ -139,6 +140,8 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
pa_assert(mainloop);
+ pa_init_i18n();
+
if (!name && !pa_proplist_contains(p, PA_PROP_APPLICATION_NAME))
return NULL;
@@ -530,7 +533,7 @@ static void setup_context(pa_context *c, pa_iochannel *io) {
c->pdispatch = pa_pdispatch_new(c->mainloop, command_table, PA_COMMAND_MAX);
if (!c->conf->cookie_valid)
- pa_log_info("No cookie loaded. Attempting to connect without.");
+ pa_log_info(_("No cookie loaded. Attempting to connect without."));
t = pa_tagstruct_command(c, PA_COMMAND_AUTH, &tag);
@@ -584,7 +587,7 @@ static int context_connect_spawn(pa_context *c) {
pa_context_ref(c);
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
- pa_log_error("socketpair(): %s", pa_cstrerror(errno));
+ pa_log_error(_("socketpair(): %s"), pa_cstrerror(errno));
pa_context_fail(c, PA_ERR_INTERNAL);
goto fail;
}
@@ -598,7 +601,7 @@ static int context_connect_spawn(pa_context *c) {
c->spawn_api.prefork();
if ((pid = fork()) < 0) {
- pa_log_error("fork(): %s", pa_cstrerror(errno));
+ pa_log_error(_("fork(): %s"), pa_cstrerror(errno));
pa_context_fail(c, PA_ERR_INTERNAL);
if (c->spawn_api.postfork)
@@ -661,7 +664,7 @@ static int context_connect_spawn(pa_context *c) {
c->spawn_api.postfork();
if (r < 0) {
- pa_log("waitpid(): %s", pa_cstrerror(errno));
+ pa_log(_("waitpid(): %s"), pa_cstrerror(errno));
pa_context_fail(c, PA_ERR_INTERNAL);
goto fail;
} else if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
@@ -1259,7 +1262,7 @@ void pa_command_extension(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t
if (!strcmp(name, "module-stream-restore"))
pa_ext_stream_restore_command(c, tag, t);
else
- pa_log("Received message for unknown extension '%s'", name);
+ pa_log(_("Received message for unknown extension '%s'"), name);
finish:
pa_context_unref(c);
diff --git a/src/pulse/error.c b/src/pulse/error.c
index 50bbf70..d9d0a8c 100644
--- a/src/pulse/error.c
+++ b/src/pulse/error.c
@@ -30,6 +30,7 @@
#include <string.h>
#include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
#include <pulsecore/core-util.h>
#include <pulsecore/native-common.h>
@@ -39,32 +40,34 @@
const char*pa_strerror(int error) {
static const char* const errortab[PA_ERR_MAX] = {
- [PA_OK] = "OK",
- [PA_ERR_ACCESS] = "Access denied",
- [PA_ERR_COMMAND] = "Unknown command",
- [PA_ERR_INVALID] = "Invalid argument",
- [PA_ERR_EXIST] = "Entity exists",
- [PA_ERR_NOENTITY] = "No such entity",
- [PA_ERR_CONNECTIONREFUSED] = "Connection refused",
- [PA_ERR_PROTOCOL] = "Protocol error",
- [PA_ERR_TIMEOUT] = "Timeout",
- [PA_ERR_AUTHKEY] = "No authorization key",
- [PA_ERR_INTERNAL] = "Internal error",
- [PA_ERR_CONNECTIONTERMINATED] = "Connection terminated",
- [PA_ERR_KILLED] = "Entity killed",
- [PA_ERR_INVALIDSERVER] = "Invalid server",
- [PA_ERR_MODINITFAILED] = "Module initalization failed",
- [PA_ERR_BADSTATE] = "Bad state",
- [PA_ERR_NODATA] = "No data",
- [PA_ERR_VERSION] = "Incompatible protocol version",
- [PA_ERR_TOOLARGE] = "Too large",
- [PA_ERR_NOTSUPPORTED] = "Not supported",
- [PA_ERR_UNKNOWN] = "Unknown error code",
- [PA_ERR_NOEXTENSION] = "No such extension"
+ [PA_OK] = N_("OK"),
+ [PA_ERR_ACCESS] = N_("Access denied"),
+ [PA_ERR_COMMAND] = N_("Unknown command"),
+ [PA_ERR_INVALID] = N_("Invalid argument"),
+ [PA_ERR_EXIST] = N_("Entity exists"),
+ [PA_ERR_NOENTITY] = N_("No such entity"),
+ [PA_ERR_CONNECTIONREFUSED] = N_("Connection refused"),
+ [PA_ERR_PROTOCOL] = N_("Protocol error"),
+ [PA_ERR_TIMEOUT] = N_("Timeout"),
+ [PA_ERR_AUTHKEY] = N_("No authorization key"),
+ [PA_ERR_INTERNAL] = N_("Internal error"),
+ [PA_ERR_CONNECTIONTERMINATED] = N_("Connection terminated"),
+ [PA_ERR_KILLED] = N_("Entity killed"),
+ [PA_ERR_INVALIDSERVER] = N_("Invalid server"),
+ [PA_ERR_MODINITFAILED] = N_("Module initalization failed"),
+ [PA_ERR_BADSTATE] = N_("Bad state"),
+ [PA_ERR_NODATA] = N_("No data"),
+ [PA_ERR_VERSION] = N_("Incompatible protocol version"),
+ [PA_ERR_TOOLARGE] = N_("Too large"),
+ [PA_ERR_NOTSUPPORTED] = N_("Not supported"),
+ [PA_ERR_UNKNOWN] = N_("Unknown error code"),
+ [PA_ERR_NOEXTENSION] = N_("No such extension")
};
+ pa_init_i18n();
+
if (error < 0 || error >= PA_ERR_MAX)
return NULL;
- return errortab[error];
+ return _(errortab[error]);
}
diff --git a/src/pulse/i18n.c b/src/pulse/i18n.c
new file mode 100644
index 0000000..7f25b20
--- /dev/null
+++ b/src/pulse/i18n.c
@@ -0,0 +1,38 @@
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2008 Lennart Poettering
+
+ PulseAudio is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with PulseAudio; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <pulsecore/once.h>
+
+#include "i18n.h"
+
+void pa_init_i18n(void) {
+
+ PA_ONCE_BEGIN {
+
+ bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+ } PA_ONCE_END;
+}
diff --git a/src/pulse/i18n.h b/src/pulse/i18n.h
new file mode 100644
index 0000000..4c0ef9d
--- /dev/null
+++ b/src/pulse/i18n.h
@@ -0,0 +1,62 @@
+#ifndef foopulsei18nhfoo
+#define foopulsei18nhfoo
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2008 Lennart Poettering
+
+ PulseAudio is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ PulseAudio is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with PulseAudio; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
+
+PA_C_DECL_BEGIN
+
+#if !defined(GETTEXT_PACKAGE)
+#error "Something is very wrong here, config.h needs to be included first"
+#endif
+
+#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 /* NLS is disabled */
+
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain)
+#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
+
+#endif /* ENABLE_NLS */
+
+void pa_init_i18n(void);
+
+PA_C_DECL_END
+
+#endif
diff --git a/src/pulse/mainloop-api.c b/src/pulse/mainloop-api.c
index 90aff16..4e3b135 100644
--- a/src/pulse/mainloop-api.c
+++ b/src/pulse/mainloop-api.c
@@ -27,6 +27,7 @@
#include <pulse/xmalloc.h>
#include <pulse/gccmacro.h>
+#include <pulse/i18n.h>
#include <pulsecore/macro.h>
@@ -65,6 +66,8 @@ void pa_mainloop_api_once(pa_mainloop_api* m, void (*callback)(pa_mainloop_api *
pa_assert(m);
pa_assert(callback);
+ pa_init_i18n();
+
i = pa_xnew(struct once_info, 1);
i->callback = callback;
i->userdata = userdata;
diff --git a/src/pulse/mainloop-signal.c b/src/pulse/mainloop-signal.c
index 9161dec..e95968a 100644
--- a/src/pulse/mainloop-signal.c
+++ b/src/pulse/mainloop-signal.c
@@ -38,6 +38,7 @@
#include <pulse/xmalloc.h>
#include <pulse/gccmacro.h>
+#include <pulse/i18n.h>
#include <pulsecore/core-error.h>
#include <pulsecore/core-util.h>
@@ -165,6 +166,8 @@ pa_signal_event* pa_signal_new(int sig, pa_signal_cb_t _callback, void *userdata
pa_assert(sig > 0);
pa_assert(_callback);
+ pa_init_i18n();
+
for (e = signals; e; e = e->next)
if (e->sig == sig)
goto fail;
diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index aaed3ca..5823e28 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -44,6 +44,7 @@
#include <pulse/timeval.h>
#include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
#include <pulsecore/core-util.h>
#include <pulsecore/llist.h>
@@ -446,6 +447,8 @@ static const pa_mainloop_api vtable = {
pa_mainloop *pa_mainloop_new(void) {
pa_mainloop *m;
+ pa_init_i18n();
+
m = pa_xnew(pa_mainloop, 1);
m->wakeup_pipe_type = 0;
diff --git a/src/pulse/proplist.c b/src/pulse/proplist.c
index 74aea20..9e0549e 100644
--- a/src/pulse/proplist.c
+++ b/src/pulse/proplist.c
@@ -27,6 +27,7 @@
#include <pulse/xmalloc.h>
#include <pulse/utf8.h>
+#include <pulse/i18n.h>
#include <pulsecore/hashmap.h>
#include <pulsecore/strbuf.h>
@@ -63,6 +64,8 @@ static void property_free(struct property *prop) {
}
pa_proplist* pa_proplist_new(void) {
+ pa_init_i18n();
+
return MAKE_PROPLIST(pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func));
}
diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 4aef5bb..93da246 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -28,9 +28,11 @@
#include <math.h>
#include <string.h>
+#include <pulse/timeval.h>
+#include <pulse/i18n.h>
+
#include <pulsecore/core-util.h>
#include <pulsecore/macro.h>
-#include <pulse/timeval.h>
#include "sample.h"
@@ -126,8 +128,10 @@ char *pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec) {
pa_assert(l);
pa_assert(spec);
+ pa_init_i18n();
+
if (!pa_sample_spec_valid(spec))
- pa_snprintf(s, l, "Invalid");
+ pa_snprintf(s, l, _("Invalid"));
else
pa_snprintf(s, l, "%s %uch %uHz", pa_sample_format_to_string(spec->format), spec->channels, spec->rate);
diff --git a/src/pulse/simple.c b/src/pulse/simple.c
index 7039683..51160ad 100644
--- a/src/pulse/simple.c
+++ b/src/pulse/simple.c
@@ -453,4 +453,3 @@ unlock_and_fail:
pa_threaded_mainloop_unlock(p->mainloop);
return (pa_usec_t) -1;
}
-
diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c
index 6b66696..fb73ff1 100644
--- a/src/pulse/thread-mainloop.c
+++ b/src/pulse/thread-mainloop.c
@@ -35,6 +35,7 @@
#include <pulse/xmalloc.h>
#include <pulse/mainloop.h>
+#include <pulse/i18n.h>
#include <pulsecore/log.h>
#include <pulsecore/hashmap.h>
@@ -94,6 +95,8 @@ static void thread(void *userdata) {
pa_threaded_mainloop *pa_threaded_mainloop_new(void) {
pa_threaded_mainloop *m;
+ pa_init_i18n();
+
m = pa_xnew(pa_threaded_mainloop, 1);
if (!(m->real_mainloop = pa_mainloop_new())) {
diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index 78b9cef..32fa6bc 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -33,15 +33,13 @@
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
+#include <locale.h>
+#include <pulse/i18n.h>
#include <pulse/pulseaudio.h>
#define TIME_EVENT_USEC 50000
-#if PA_API_VERSION < 10
-#error Invalid PulseAudio API version
-#endif
-
#define CLEAR_LINE "\x1B[K"
static enum { RECORD, PLAYBACK } mode = PLAYBACK;
@@ -92,7 +90,7 @@ static void do_stream_write(size_t length) {
l = buffer_length;
if (pa_stream_write(stream, (uint8_t*) buffer + buffer_index, l, NULL, 0, PA_SEEK_RELATIVE) < 0) {
- fprintf(stderr, "pa_stream_write() failed: %s\n", pa_strerror(pa_context_errno(context)));
+ fprintf(stderr, _("pa_stream_write() failed: %s\n"), pa_strerror(pa_context_errno(context)));
quit(1);
return;
}
@@ -131,7 +129,7 @@ static void stream_read_callback(pa_stream *s, size_t length, void *userdata) {
mainloop_api->io_enable(stdio_event, PA_IO_EVENT_OUTPUT);
if (pa_stream_peek(s, &data, &length) < 0) {
- fprintf(stderr, "pa_stream_peek() failed: %s\n", pa_strerror(pa_context_errno(context)));
+ fprintf(stderr, _("pa_stream_peek() failed: %s\n"), pa_strerror(pa_context_errno(context)));
quit(1);
return;
}
@@ -140,9 +138,9 @@ static void stream_read_callback(pa_stream *s, size_t length, void *userdata) {
assert(length > 0);
if (buffer) {
- fprintf(stderr, "Buffer overrun, dropping incoming data\n");
+ fprintf(stderr, _("Buffer overrun, dropping incoming data\n"));
if (pa_stream_drop(s) < 0) {
- fprintf(stderr, "pa_stream_drop() failed: %s\n", pa_strerror(pa_context_errno(context)));
+ fprintf(stderr, _("pa_stream_drop() failed: %s\n"), pa_strerror(pa_context_errno(context)));
quit(1);
}
return;
@@ -168,25 +166,25 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
const pa_buffer_attr *a;
char cmt[PA_CHANNEL_MAP_SNPRINT_MAX], sst[PA_SAMPLE_SPEC_SNPRINT_MAX];
- fprintf(stderr, "Stream successfully created.\n");
+ fprintf(stderr, _("Stream successfully created.\n"));
if (!(a = pa_stream_get_buffer_attr(s)))
- fprintf(stderr, "pa_stream_get_buffer_attr() failed: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
+ fprintf(stderr, _("pa_stream_get_buffer_attr() failed: %s\n"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));
else {
if (mode == PLAYBACK)
- fprintf(stderr, "Buffer metrics: maxlength=%u, tlength=%u, prebuf=%u, minreq=%u\n", a->maxlength, a->tlength, a->prebuf, a->minreq);
+ fprintf(stderr, _("Buffer metrics: maxlength=%u, tlength=%u, prebuf=%u, minreq=%u\n"), a->maxlength, a->tlength, a->prebuf, a->minreq);
else {
assert(mode == RECORD);
- fprintf(stderr, "Buffer metrics: maxlength=%u, fragsize=%u\n", a->maxlength, a->fragsize);
+ fprintf(stderr, _("Buffer metrics: maxlength=%u, fragsize=%u\n"), a->maxlength, a->fragsize);
}
}
- fprintf(stderr, "Using sample spec '%s', channel map '%s'.\n",
+ fprintf(stderr, _("Using sample spec '%s', channel map '%s'.\n"),
pa_sample_spec_snprint(sst, sizeof(sst), pa_stream_get_sample_spec(s)),
pa_channel_map_snprint(cmt, sizeof(cmt), pa_stream_get_channel_map(s)));
- fprintf(stderr, "Connected to device %s (%u, %ssuspended).\n",
+ fprintf(stderr, _("Connected to device %s (%u, %ssuspended).\n"),
pa_stream_get_device_name(s),
pa_stream_get_device_index(s),
pa_stream_is_suspended(s) ? "" : "not ");
@@ -196,7 +194,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
case PA_STREAM_FAILED:
default:
- fprintf(stderr, "Stream error: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
+ fprintf(stderr, _("Stream error: %s\n"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));
quit(1);
}
}
@@ -206,9 +204,9 @@ static void stream_suspended_callback(pa_stream *s, void *userdata) {
if (verbose) {
if (pa_stream_is_suspended(s))
- fprintf(stderr, "Stream device suspended." CLEAR_LINE " \n");
+ fprintf(stderr, _("Stream device suspended.%s \n"), CLEAR_LINE);
else
- fprintf(stderr, "Stream device resumed." CLEAR_LINE " \n");
+ fprintf(stderr, _("Stream device resumed.%s \n"), CLEAR_LINE);
}
}
@@ -216,28 +214,28 @@ static void stream_underflow_callback(pa_stream *s, void *userdata) {
assert(s);
if (verbose)
- fprintf(stderr, "Stream underrun." CLEAR_LINE " \n");
+ fprintf(stderr, _("Stream underrun.%s \n"), CLEAR_LINE);
}
static void stream_overflow_callback(pa_stream *s, void *userdata) {
assert(s);
if (verbose)
- fprintf(stderr, "Stream overrun." CLEAR_LINE " \n");
+ fprintf(stderr, _("Stream overrun.%s \n"), CLEAR_LINE);
}
static void stream_started_callback(pa_stream *s, void *userdata) {
assert(s);
if (verbose)
- fprintf(stderr, "Stream started." CLEAR_LINE " \n");
+ fprintf(stderr, _("Stream started.%s \n"), CLEAR_LINE);
}
static void stream_moved_callback(pa_stream *s, void *userdata) {
assert(s);
if (verbose)
- fprintf(stderr, "Stream moved to device %s (%u, %ssuspended)." CLEAR_LINE " \n", pa_stream_get_device_name(s), pa_stream_get_device_index(s), pa_stream_is_suspended(s) ? "" : "not ");
+ fprintf(stderr, _("Stream moved to device %s (%u, %ssuspended).%s \n"), pa_stream_get_device_name(s), pa_stream_get_device_index(s), pa_stream_is_suspended(s) ? "" : _("not "), CLEAR_LINE);
}
/* This is called whenever the context status changes */
@@ -258,10 +256,10 @@ static void context_state_callback(pa_context *c, void *userdata) {
assert(!stream);
if (verbose)
- fprintf(stderr, "Connection established." CLEAR_LINE " \n");
+ fprintf(stderr, _("Connection established.%s \n"), CLEAR_LINE);
if (!(stream = pa_stream_new(c, stream_name, &sample_spec, channel_map_set ? &channel_map : NULL))) {
- fprintf(stderr, "pa_stream_new() failed: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("pa_stream_new() failed: %s\n"), pa_strerror(pa_context_errno(c)));
goto fail;
}
@@ -286,13 +284,13 @@ static void context_state_callback(pa_context *c, void *userdata) {
if (mode == PLAYBACK) {
pa_cvolume cv;
if ((r = pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, pa_cvolume_set(&cv, sample_spec.channels, volume), NULL)) < 0) {
- fprintf(stderr, "pa_stream_connect_playback() failed: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("pa_stream_connect_playback() failed: %s\n"), pa_strerror(pa_context_errno(c)));
goto fail;
}
} else {
if ((r = pa_stream_connect_record(stream, device, latency > 0 ? &buffer_attr : NULL, flags)) < 0) {
- fprintf(stderr, "pa_stream_connect_record() failed: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("pa_stream_connect_record() failed: %s\n"), pa_strerror(pa_context_errno(c)));
goto fail;
}
}
@@ -306,7 +304,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_FAILED:
default:
- fprintf(stderr, "Connection failure: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Connection failure: %s\n"), pa_strerror(pa_context_errno(c)));
goto fail;
}
@@ -327,12 +325,12 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {
pa_operation *o;
if (!success) {
- fprintf(stderr, "Failed to drain stream: %s\n", pa_strerror(pa_context_errno(context)));
+ fprintf(stderr, _("Failed to drain stream: %s\n"), pa_strerror(pa_context_errno(context)));
quit(1);
}
if (verbose)
- fprintf(stderr, "Playback stream drained.\n");
+ fprintf(stderr, _("Playback stream drained.\n"));
pa_stream_disconnect(stream);
pa_stream_unref(stream);
@@ -342,7 +340,7 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {
pa_context_disconnect(context);
else {
if (verbose)
- fprintf(stderr, "Draining connection to server.\n");
+ fprintf(stderr, _("Draining connection to server.\n"));
}
}
@@ -368,13 +366,13 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even
if ((r = read(fd, buffer, l)) <= 0) {
if (r == 0) {
if (verbose)
- fprintf(stderr, "Got EOF.\n");
+ fprintf(stderr, _("Got EOF.\n"));
if (stream) {
pa_operation *o;
if (!(o = pa_stream_drain(stream, stream_drain_complete, NULL))) {
- fprintf(stderr, "pa_stream_drain(): %s\n", pa_strerror(pa_context_errno(context)));
+ fprintf(stderr, _("pa_stream_drain(): %s\n"), pa_strerror(pa_context_errno(context)));
quit(1);
return;
}
@@ -384,7 +382,7 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even
quit(0);
} else {
- fprintf(stderr, "read() failed: %s\n", strerror(errno));
+ fprintf(stderr, _("read() failed: %s\n"), strerror(errno));
quit(1);
}
@@ -416,7 +414,7 @@ static void stdout_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_eve
assert(buffer_length);
if ((r = write(fd, (uint8_t*) buffer+buffer_index, buffer_length)) <= 0) {
- fprintf(stderr, "write() failed: %s\n", strerror(errno));
+ fprintf(stderr, _("write() failed: %s\n"), strerror(errno));
quit(1);
mainloop_api->io_free(stdio_event);
@@ -437,7 +435,7 @@ static void stdout_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_eve
/* UNIX signal to quit recieved */
static void exit_signal_callback(pa_mainloop_api*m, pa_signal_event *e, int sig, void *userdata) {
if (verbose)
- fprintf(stderr, "Got signal, exiting.\n");
+ fprintf(stderr, _("Got signal, exiting.\n"));
quit(0);
}
@@ -451,12 +449,12 @@ static void stream_update_timing_callback(pa_stream *s, int success, void *userd
if (!success ||
pa_stream_get_time(s, &usec) < 0 ||
pa_stream_get_latency(s, &l, &negative) < 0) {
- fprintf(stderr, "Failed to get latency: %s\n", pa_strerror(pa_context_errno(context)));
+ fprintf(stderr, _("Failed to get latency: %s\n"), pa_strerror(pa_context_errno(context)));
quit(1);
return;
}
- fprintf(stderr, "Time: %0.3f sec; Latency: %0.0f usec. \r",
+ fprintf(stderr, _("Time: %0.3f sec; Latency: %0.0f usec. \r"),
(float) usec / 1000000,
(float) l * (negative?-1:1));
}
@@ -476,7 +474,7 @@ static void time_event_callback(pa_mainloop_api*m, pa_time_event *e, const struc
if (stream && pa_stream_get_state(stream) == PA_STREAM_READY) {
pa_operation *o;
if (!(o = pa_stream_update_timing_info(stream, stream_update_timing_callback, NULL)))
- fprintf(stderr, "pa_stream_update_timing_info() failed: %s\n", pa_strerror(pa_context_errno(context)));
+ fprintf(stderr, _("pa_stream_update_timing_info() failed: %s\n"), pa_strerror(pa_context_errno(context)));
else
pa_operation_unref(o);
}
@@ -489,7 +487,7 @@ static void time_event_callback(pa_mainloop_api*m, pa_time_event *e, const struc
static void help(const char *argv0) {
- printf("%s [options]\n\n"
+ printf(_("%s [options]\n\n"
" -h, --help Show this help\n"
" --version Show version\n\n"
" -r, --record Create a connection for recording\n"
@@ -515,7 +513,7 @@ static void help(const char *argv0) {
" --no-remix Don't upmix or downmix channels.\n"
" --no-remap Map channels by index instead of name.\n"
" --latency=BYTES Request the specified latency in bytes.\n"
- " --process-time=BYTES Request the specified process time per request in bytes.\n"
+ " --process-time=BYTES Request the specified process time per request in bytes.\n")
,
argv0);
}
@@ -568,6 +566,9 @@ int main(int argc, char *argv[]) {
{NULL, 0, NULL, 0}
};
+ setlocale(LC_ALL, "");
+ bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
+
if (!(bn = strrchr(argv[0], '/')))
bn = argv[0];
else
@@ -587,7 +588,7 @@ int main(int argc, char *argv[]) {
goto quit;
case ARG_VERSION:
- printf("pacat "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version());
+ printf(_("pacat %s\nCompiled with libpulse %s\nLinked with libpulse %s\n"), PACKAGE_VERSION, pa_get_headers_version(), pa_get_library_version());
ret = 0;
goto quit;
@@ -643,7 +644,7 @@ int main(int argc, char *argv[]) {
case ARG_CHANNELMAP:
if (!pa_channel_map_parse(&channel_map, optarg)) {
- fprintf(stderr, "Invalid channel map '%s'\n", optarg);
+ fprintf(stderr, _("Invalid channel map '%s'\n"), optarg);
goto quit;
}
@@ -672,14 +673,14 @@ int main(int argc, char *argv[]) {
case ARG_LATENCY:
if (((latency = atoi(optarg))) <= 0) {
- fprintf(stderr, "Invalid latency specification '%s'\n", optarg);
+ fprintf(stderr, _("Invalid latency specification '%s'\n"), optarg);
goto quit;
}
break;
case ARG_PROCESS_TIME:
if (((process_time = atoi(optarg))) <= 0) {
- fprintf(stderr, "Invalid process time specification '%s'\n", optarg);
+ fprintf(stderr, _("Invalid process time specification '%s'\n"), optarg);
goto quit;
}
break;
@@ -690,19 +691,19 @@ int main(int argc, char *argv[]) {
}
if (!pa_sample_spec_valid(&sample_spec)) {
- fprintf(stderr, "Invalid sample specification\n");
+ fprintf(stderr, _("Invalid sample specification\n"));
goto quit;
}
if (channel_map_set && channel_map.channels != sample_spec.channels) {
- fprintf(stderr, "Channel map doesn't match sample specification\n");
+ fprintf(stderr, _("Channel map doesn't match sample specification\n"));
goto quit;
}
if (verbose) {
char t[PA_SAMPLE_SPEC_SNPRINT_MAX];
pa_sample_spec_snprint(t, sizeof(t), &sample_spec);
- fprintf(stderr, "Opening a %s stream with sample specification '%s'.\n", mode == RECORD ? "recording" : "playback", t);
+ fprintf(stderr, _("Opening a %s stream with sample specification '%s'.\n"), mode == RECORD ? _("recording") : _("playback"), t);
}
if (!(optind >= argc)) {
@@ -710,12 +711,12 @@ int main(int argc, char *argv[]) {
int fd;
if ((fd = open(argv[optind], mode == PLAYBACK ? O_RDONLY : O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0) {
- fprintf(stderr, "open(): %s\n", strerror(errno));
+ fprintf(stderr, _("open(): %s\n"), strerror(errno));
goto quit;
}
if (dup2(fd, mode == PLAYBACK ? 0 : 1) < 0) {
- fprintf(stderr, "dup2(): %s\n", strerror(errno));
+ fprintf(stderr, _("dup2(): %s\n"), strerror(errno));
goto quit;
}
@@ -725,7 +726,7 @@ int main(int argc, char *argv[]) {
stream_name = pa_xstrdup(argv[optind]);
} else {
- fprintf(stderr, "Too many arguments.\n");
+ fprintf(stderr, _("Too many arguments.\n"));
goto quit;
}
}
@@ -738,7 +739,7 @@ int main(int argc, char *argv[]) {
/* Set up a new main loop */
if (!(m = pa_mainloop_new())) {
- fprintf(stderr, "pa_mainloop_new() failed.\n");
+ fprintf(stderr, _("pa_mainloop_new() failed.\n"));
goto quit;
}
@@ -759,13 +760,13 @@ int main(int argc, char *argv[]) {
mode == PLAYBACK ? STDIN_FILENO : STDOUT_FILENO,
mode == PLAYBACK ? PA_IO_EVENT_INPUT : PA_IO_EVENT_OUTPUT,
mode == PLAYBACK ? stdin_callback : stdout_callback, NULL))) {
- fprintf(stderr, "io_new() failed.\n");
+ fprintf(stderr, _("io_new() failed.\n"));
goto quit;
}
/* Create a new connection context */
if (!(context = pa_context_new(mainloop_api, client_name))) {
- fprintf(stderr, "pa_context_new() failed.\n");
+ fprintf(stderr, _("pa_context_new() failed.\n"));
goto quit;
}
@@ -781,14 +782,14 @@ int main(int argc, char *argv[]) {
pa_timeval_add(&tv, TIME_EVENT_USEC);
if (!(time_event = mainloop_api->time_new(mainloop_api, &tv, time_event_callback, NULL))) {
- fprintf(stderr, "time_new() failed.\n");
+ fprintf(stderr, _("time_new() failed.\n"));
goto quit;
}
}
/* Run the main loop */
if (pa_mainloop_run(m, &ret) < 0) {
- fprintf(stderr, "pa_mainloop_run() failed.\n");
+ fprintf(stderr, _("pa_mainloop_run() failed.\n"));
goto quit;
}
diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c
index 67d9525..24cddaa 100644
--- a/src/utils/pacmd.c
+++ b/src/utils/pacmd.c
@@ -31,10 +31,12 @@
#include <errno.h>
#include <string.h>
#include <sys/un.h>
+#include <locale.h>
#include <pulse/error.h>
#include <pulse/util.h>
#include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
#include <pulsecore/core-util.h>
#include <pulsecore/log.h>
@@ -50,13 +52,16 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
fd_set ifds, ofds;
char *cli;
+ setlocale(LC_ALL, "");
+ bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
+
if (pa_pid_file_check_running(&pid, "pulseaudio") < 0) {
- pa_log("no PulseAudio daemon running");
+ pa_log("No PulseAudio daemon running");
goto fail;
}
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- pa_log("socket(PF_UNIX, SOCK_STREAM, 0): %s", strerror(errno));
+ pa_log(_("socket(PF_UNIX, SOCK_STREAM, 0): %s"), strerror(errno));
goto fail;
}
@@ -73,7 +78,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
int r;
if ((r = connect(fd, (struct sockaddr*) &sa, sizeof(sa))) < 0 && (errno != ECONNREFUSED && errno != ENOENT)) {
- pa_log("connect(): %s", strerror(errno));
+ pa_log(_("connect(): %s"), strerror(errno));
goto fail;
}
@@ -81,7 +86,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
break;
if (pa_pid_file_kill(SIGUSR2, NULL, "pulseaudio") < 0) {
- pa_log("failed to kill PulseAudio daemon.");
+ pa_log(_("Failed to kill PulseAudio daemon."));
goto fail;
}
@@ -89,7 +94,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
}
if (i >= 5) {
- pa_log("daemon not responding.");
+ pa_log(_("Daemon not responding."));
goto fail;
}
@@ -104,7 +109,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
for (;;) {
if (select(FD_SETSIZE, &ifds, &ofds, NULL, NULL) < 0) {
- pa_log("select(): %s", strerror(errno));
+ pa_log(_("select(): %s"), strerror(errno));
goto fail;
}
@@ -116,7 +121,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
if (r == 0)
break;
- pa_log("read(): %s", strerror(errno));
+ pa_log(_("read(): %s"), strerror(errno));
goto fail;
}
@@ -132,7 +137,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
if (r == 0)
break;
- pa_log("read(): %s", strerror(errno));
+ pa_log(_("read(): %s"), strerror(errno));
goto fail;
}
@@ -145,7 +150,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
assert(obuf_length);
if ((r = write(1, obuf + obuf_index, obuf_length)) < 0) {
- pa_log("write(): %s", strerror(errno));
+ pa_log(_("write(): %s"), strerror(errno));
goto fail;
}
@@ -159,7 +164,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
assert(ibuf_length);
if ((r = write(fd, ibuf + ibuf_index, ibuf_length)) < 0) {
- pa_log("write(): %s", strerror(errno));
+ pa_log(_("write(): %s"), strerror(errno));
goto fail;
}
@@ -182,7 +187,6 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
FD_SET(fd, &ofds);
}
-
ret = 0;
fail:
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 4cca2f8..f5961a1 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -32,16 +32,14 @@
#include <stdlib.h>
#include <limits.h>
#include <getopt.h>
+#include <locale.h>
#include <sndfile.h>
+#include <pulse/i18n.h>
#include <pulse/pulseaudio.h>
#include <pulsecore/core-util.h>
-#if PA_API_VERSION < 10
-#error Invalid PulseAudio API version
-#endif
-
#define BUFSIZE 1024
static pa_context *context = NULL;
@@ -106,19 +104,19 @@ static void complete_action(void) {
static void stat_callback(pa_context *c, const pa_stat_info *i, void *userdata) {
char s[128];
if (!i) {
- fprintf(stderr, "Failed to get statistics: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get statistics: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
pa_bytes_snprint(s, sizeof(s), i->memblock_total_size);
- printf("Currently in use: %u blocks containing %s bytes total.\n", i->memblock_total, s);
+ printf(_("Currently in use: %u blocks containing %s bytes total.\n"), i->memblock_total, s);
pa_bytes_snprint(s, sizeof(s), i->memblock_allocated_size);
- printf("Allocated during whole lifetime: %u blocks containing %s bytes total.\n", i->memblock_allocated, s);
+ printf(_("Allocated during whole lifetime: %u blocks containing %s bytes total.\n"), i->memblock_allocated, s);
pa_bytes_snprint(s, sizeof(s), i->scache_size);
- printf("Sample cache size: %s\n", s);
+ printf(_("Sample cache size: %s\n"), s);
complete_action();
}
@@ -127,21 +125,21 @@ static void get_server_info_callback(pa_context *c, const pa_server_info *i, voi
char s[PA_SAMPLE_SPEC_SNPRINT_MAX];
if (!i) {
- fprintf(stderr, "Failed to get server information: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get server information: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec);
- printf("User name: %s\n"
+ printf(_("User name: %s\n"
"Host Name: %s\n"
"Server Name: %s\n"
"Server Version: %s\n"
"Default Sample Specification: %s\n"
"Default Sink: %s\n"
"Default Source: %s\n"
- "Cookie: %08x\n",
+ "Cookie: %08x\n"),
i->user_name,
i->host_name,
i->server_name,
@@ -159,7 +157,7 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
char *pl;
if (is_last < 0) {
- fprintf(stderr, "Failed to get sink information: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get sink information: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -175,7 +173,7 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
printf("\n");
nl = 1;
- printf("*** Sink #%u ***\n"
+ printf(_("*** Sink #%u ***\n"
"Name: %s\n"
"Driver: %s\n"
"Sample Specification: %s\n"
@@ -185,14 +183,14 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
"Monitor Source: %s\n"
"Latency: %0.0f usec, configured %0.0f usec\n"
"Flags: %s%s%s%s%s%s\n"
- "Properties:\n%s",
+ "Properties:\n%s"),
i->index,
i->name,
pa_strnull(i->driver),
pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
i->owner_module,
- i->mute ? "muted" : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
+ i->mute ? _("muted") : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
pa_strnull(i->monitor_source_name),
(double) i->latency, (double) i->configured_latency,
i->flags & PA_SINK_HARDWARE ? "HARDWARE " : "",
@@ -211,7 +209,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
char *pl;
if (is_last < 0) {
- fprintf(stderr, "Failed to get source information: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get source information: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -227,7 +225,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
printf("\n");
nl = 1;
- printf("*** Source #%u ***\n"
+ printf(_("*** Source #%u ***\n"
"Name: %s\n"
"Driver: %s\n"
"Sample Specification: %s\n"
@@ -237,7 +235,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
"Monitor of Sink: %s\n"
"Latency: %0.0f usec, configured %0.0f usec\n"
"Flags: %s%s%s%s%s%s\n"
- "Properties:\n%s",
+ "Properties:\n%s"),
i->index,
i->name,
pa_strnull(i->driver),
@@ -245,7 +243,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
i->owner_module,
i->mute ? "muted" : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
- i->monitor_of_sink_name ? i->monitor_of_sink_name : "n/a",
+ i->monitor_of_sink_name ? i->monitor_of_sink_name : _("n/a"),
(double) i->latency, (double) i->configured_latency,
i->flags & PA_SOURCE_HARDWARE ? "HARDWARE " : "",
i->flags & PA_SOURCE_NETWORK ? "NETWORK " : "",
@@ -262,7 +260,7 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int
char t[32];
if (is_last < 0) {
- fprintf(stderr, "Failed to get module information: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get module information: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -280,15 +278,15 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int
snprintf(t, sizeof(t), "%u", i->n_used);
- printf("*** Module #%u ***\n"
+ printf(_("*** Module #%u ***\n"
"Name: %s\n"
"Argument: %s\n"
"Usage counter: %s\n"
- "Auto unload: %s\n",
+ "Auto unload: %s\n"),
i->index,
i->name,
i->argument ? i->argument : "",
- i->n_used != PA_INVALID_INDEX ? t : "n/a",
+ i->n_used != PA_INVALID_INDEX ? t : _("n/a"),
pa_yes_no(i->auto_unload));
}
@@ -297,7 +295,7 @@ static void get_client_info_callback(pa_context *c, const pa_client_info *i, int
char *pl;
if (is_last < 0) {
- fprintf(stderr, "Failed to get client information: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get client information: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -315,13 +313,13 @@ static void get_client_info_callback(pa_context *c, const pa_client_info *i, int
snprintf(t, sizeof(t), "%u", i->owner_module);
- printf("*** Client #%u ***\n"
+ printf(_("*** Client #%u ***\n"
"Driver: %s\n"
"Owner Module: %s\n"
- "Properties:\n%s",
+ "Properties:\n%s"),
i->index,
pa_strnull(i->driver),
- i->owner_module != PA_INVALID_INDEX ? t : "n/a",
+ i->owner_module != PA_INVALID_INDEX ? t : _("n/a"),
pl = pa_proplist_to_string(i->proplist));
pa_xfree(pl);
@@ -332,7 +330,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
char *pl;
if (is_last < 0) {
- fprintf(stderr, "Failed to get sink input information: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get sink input information: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -351,7 +349,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
snprintf(t, sizeof(t), "%u", i->owner_module);
snprintf(k, sizeof(k), "%u", i->client);
- printf("*** Sink Input #%u ***\n"
+ printf(_("*** Sink Input #%u ***\n"
"Driver: %s\n"
"Owner Module: %s\n"
"Client: %s\n"
@@ -362,18 +360,18 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
"Buffer Latency: %0.0f usec\n"
"Sink Latency: %0.0f usec\n"
"Resample method: %s\n"
- "Properties:\n%s",
+ "Properties:\n%s"),
i->index,
pa_strnull(i->driver),
- i->owner_module != PA_INVALID_INDEX ? t : "n/a",
- i->client != PA_INVALID_INDEX ? k : "n/a",
+ i->owner_module != PA_INVALID_INDEX ? t : _("n/a"),
+ i->client != PA_INVALID_INDEX ? k : _("n/a"),
i->sink,
pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
- i->mute ? "muted" : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
+ i->mute ? _("muted") : pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
(double) i->buffer_usec,
(double) i->sink_usec,
- i->resample_method ? i->resample_method : "n/a",
+ i->resample_method ? i->resample_method : _("n/a"),
pl = pa_proplist_to_string(i->proplist));
pa_xfree(pl);
@@ -384,7 +382,7 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
char *pl;
if (is_last < 0) {
- fprintf(stderr, "Failed to get source output information: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get source output information: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -404,7 +402,7 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
snprintf(t, sizeof(t), "%u", i->owner_module);
snprintf(k, sizeof(k), "%u", i->client);
- printf("*** Source Output #%u ***\n"
+ printf(_("*** Source Output #%u ***\n"
"Driver: %s\n"
"Owner Module: %s\n"
"Client: %s\n"
@@ -414,17 +412,17 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
"Buffer Latency: %0.0f usec\n"
"Source Latency: %0.0f usec\n"
"Resample method: %s\n"
- "Properties:\n%s",
+ "Properties:\n%s"),
i->index,
pa_strnull(i->driver),
- i->owner_module != PA_INVALID_INDEX ? t : "n/a",
- i->client != PA_INVALID_INDEX ? k : "n/a",
+ i->owner_module != PA_INVALID_INDEX ? t : _("n/a"),
+ i->client != PA_INVALID_INDEX ? k : _("n/a"),
i->source,
pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
(double) i->buffer_usec,
(double) i->source_usec,
- i->resample_method ? i->resample_method : "n/a",
+ i->resample_method ? i->resample_method : _("n/a"),
pl = pa_proplist_to_string(i->proplist));
pa_xfree(pl);
@@ -435,7 +433,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
char *pl;
if (is_last < 0) {
- fprintf(stderr, "Failed to get sample information: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get sample information: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -454,7 +452,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
pa_bytes_snprint(t, sizeof(t), i->bytes);
- printf("*** Sample #%u ***\n"
+ printf(_("*** Sample #%u ***\n"
"Name: %s\n"
"Volume: %s\n"
"Sample Specification: %s\n"
@@ -463,16 +461,16 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
"Size: %s\n"
"Lazy: %s\n"
"Filename: %s\n"
- "Properties:\n%s",
+ "Properties:\n%s"),
i->index,
i->name,
pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
- pa_sample_spec_valid(&i->sample_spec) ? pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec) : "n/a",
- pa_sample_spec_valid(&i->sample_spec) ? pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map) : "n/a",
+ pa_sample_spec_valid(&i->sample_spec) ? pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec) : _("n/a"),
+ pa_sample_spec_valid(&i->sample_spec) ? pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map) : _("n/a"),
(double) i->duration/1000000,
t,
pa_yes_no(i->lazy),
- i->filename ? i->filename : "n/a",
+ i->filename ? i->filename : _("n/a"),
pl = pa_proplist_to_string(i->proplist));
pa_xfree(pl);
@@ -480,7 +478,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
static void get_autoload_info_callback(pa_context *c, const pa_autoload_info *i, int is_last, void *userdata) {
if (is_last < 0) {
- fprintf(stderr, "Failed to get autoload information: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failed to get autoload information: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -496,21 +494,21 @@ static void get_autoload_info_callback(pa_context *c, const pa_autoload_info *i,
printf("\n");
nl = 1;
- printf("*** Autoload Entry #%u ***\n"
+ printf(_("*** Autoload Entry #%u ***\n"
"Name: %s\n"
"Type: %s\n"
"Module: %s\n"
- "Argument: %s\n",
+ "Argument: %s\n"),
i->index,
i->name,
- i->type == PA_AUTOLOAD_SINK ? "sink" : "source",
+ i->type == PA_AUTOLOAD_SINK ? _("sink") : _("source"),
i->module,
i->argument ? i->argument : "");
}
static void simple_callback(pa_context *c, int success, void *userdata) {
if (!success) {
- fprintf(stderr, "Failure: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failure: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -520,7 +518,7 @@ static void simple_callback(pa_context *c, int success, void *userdata) {
static void index_callback(pa_context *c, uint32_t idx, void *userdata) {
if (idx == PA_INVALID_INDEX) {
- fprintf(stderr, "Failure: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failure: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -544,7 +542,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
case PA_STREAM_FAILED:
default:
- fprintf(stderr, "Failed to upload sample: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
+ fprintf(stderr, _("Failed to upload sample: %s\n"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));
quit(1);
}
}
@@ -561,7 +559,7 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) {
if ((sf_readf_float(sndfile, d, l)) != l) {
pa_xfree(d);
- fprintf(stderr, "Premature end of file\n");
+ fprintf(stderr, _("Premature end of file\n"));
quit(1);
}
@@ -665,19 +663,19 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_FAILED:
default:
- fprintf(stderr, "Connection failure: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Connection failure: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
}
}
static void exit_signal_callback(pa_mainloop_api *m, pa_signal_event *e, int sig, void *userdata) {
- fprintf(stderr, "Got SIGINT, exiting.\n");
+ fprintf(stderr, _("Got SIGINT, exiting.\n"));
quit(0);
}
static void help(const char *argv0) {
- printf("%s [options] stat\n"
+ printf(_("%s [options] stat\n"
"%s [options] list\n"
"%s [options] exit\n"
"%s [options] upload-sample FILENAME [NAME]\n"
@@ -692,7 +690,7 @@ static void help(const char *argv0) {
" -h, --help Show this help\n"
" --version Show version\n\n"
" -s, --server=SERVER The name of the server to connect to\n"
- " -n, --client-name=NAME How to call this client on the server\n",
+ " -n, --client-name=NAME How to call this client on the server\n"),
argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0, argv0);
}
@@ -712,6 +710,9 @@ int main(int argc, char *argv[]) {
{NULL, 0, NULL, 0}
};
+ setlocale(LC_ALL, "");
+ bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
+
if (!(bn = strrchr(argv[0], '/')))
bn = argv[0];
else
@@ -725,7 +726,12 @@ int main(int argc, char *argv[]) {
goto quit;
case ARG_VERSION:
- printf("pactl "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version());
+ printf(_("pactl %s\n"
+ "Compiled with libpulse %s\n"
+ "Linked with libpulse %s\n"),
+ PACKAGE_VERSION,
+ pa_get_headers_version(),
+ pa_get_library_version());
ret = 0;
goto quit;
@@ -759,7 +765,7 @@ int main(int argc, char *argv[]) {
action = UPLOAD_SAMPLE;
if (optind+1 >= argc) {
- fprintf(stderr, "Please specify a sample file to load\n");
+ fprintf(stderr, _("Please specify a sample file to load\n"));
goto quit;
}
@@ -781,7 +787,7 @@ int main(int argc, char *argv[]) {
memset(&sfinfo, 0, sizeof(sfinfo));
if (!(sndfile = sf_open(argv[optind+1], SFM_READ, &sfinfo))) {
- fprintf(stderr, "Failed to open sound file.\n");
+ fprintf(stderr, _("Failed to open sound file.\n"));
goto quit;
}
@@ -793,7 +799,7 @@ int main(int argc, char *argv[]) {
} else if (!strcmp(argv[optind], "play-sample")) {
action = PLAY_SAMPLE;
if (argc != optind+2 && argc != optind+3) {
- fprintf(stderr, "You have to specify a sample name to play\n");
+ fprintf(stderr, _("You have to specify a sample name to play\n"));
goto quit;
}
@@ -805,7 +811,7 @@ int main(int argc, char *argv[]) {
} else if (!strcmp(argv[optind], "remove-sample")) {
action = REMOVE_SAMPLE;
if (argc != optind+2) {
- fprintf(stderr, "You have to specify a sample name to remove\n");
+ fprintf(stderr, _("You have to specify a sample name to remove\n"));
goto quit;
}
@@ -813,7 +819,7 @@ int main(int argc, char *argv[]) {
} else if (!strcmp(argv[optind], "move-sink-input")) {
action = MOVE_SINK_INPUT;
if (argc != optind+3) {
- fprintf(stderr, "You have to specify a sink input index and a sink\n");
+ fprintf(stderr, _("You have to specify a sink input index and a sink\n"));
goto quit;
}
@@ -822,7 +828,7 @@ int main(int argc, char *argv[]) {
} else if (!strcmp(argv[optind], "move-source-output")) {
action = MOVE_SOURCE_OUTPUT;
if (argc != optind+3) {
- fprintf(stderr, "You have to specify a source output index and a source\n");
+ fprintf(stderr, _("You have to specify a source output index and a source\n"));
goto quit;
}
@@ -836,7 +842,7 @@ int main(int argc, char *argv[]) {
action = LOAD_MODULE;
if (argc <= optind+1) {
- fprintf(stderr, "You have to specify a module name and arguments.\n");
+ fprintf(stderr, _("You have to specify a module name and arguments.\n"));
goto quit;
}
@@ -856,7 +862,7 @@ int main(int argc, char *argv[]) {
action = UNLOAD_MODULE;
if (argc != optind+2) {
- fprintf(stderr, "You have to specify a module index\n");
+ fprintf(stderr, _("You have to specify a module index\n"));
goto quit;
}
@@ -866,7 +872,7 @@ int main(int argc, char *argv[]) {
action = SUSPEND_SINK;
if (argc > optind+3 || optind+1 >= argc) {
- fprintf(stderr, "You may not specify more than one sink. You have to specify at least one boolean value.\n");
+ fprintf(stderr, _("You may not specify more than one sink. You have to specify at least one boolean value.\n"));
goto quit;
}
@@ -879,7 +885,7 @@ int main(int argc, char *argv[]) {
action = SUSPEND_SOURCE;
if (argc > optind+3 || optind+1 >= argc) {
- fprintf(stderr, "You may not specify more than one source. You have to specify at least one boolean value.\n");
+ fprintf(stderr, _("You may not specify more than one source. You have to specify at least one boolean value.\n"));
goto quit;
}
@@ -895,12 +901,12 @@ int main(int argc, char *argv[]) {
}
if (action == NONE) {
- fprintf(stderr, "No valid command specified.\n");
+ fprintf(stderr, _("No valid command specified.\n"));
goto quit;
}
if (!(m = pa_mainloop_new())) {
- fprintf(stderr, "pa_mainloop_new() failed.\n");
+ fprintf(stderr, _("pa_mainloop_new() failed.\n"));
goto quit;
}
@@ -914,7 +920,7 @@ int main(int argc, char *argv[]) {
#endif
if (!(context = pa_context_new(mainloop_api, client_name))) {
- fprintf(stderr, "pa_context_new() failed.\n");
+ fprintf(stderr, _("pa_context_new() failed.\n"));
goto quit;
}
@@ -922,7 +928,7 @@ int main(int argc, char *argv[]) {
pa_context_connect(context, server, 0, NULL);
if (pa_mainloop_run(m, &ret) < 0) {
- fprintf(stderr, "pa_mainloop_run() failed.\n");
+ fprintf(stderr, _("pa_mainloop_run() failed.\n"));
goto quit;
}
diff --git a/src/utils/paplay.c b/src/utils/paplay.c
index 1b6228b..9264a94 100644
--- a/src/utils/paplay.c
+++ b/src/utils/paplay.c
@@ -37,10 +37,7 @@
#include <sndfile.h>
#include <pulse/pulseaudio.h>
-
-#if PA_API_VERSION < 9
-#error Invalid PulseAudio API version
-#endif
+#include <pulse/i18n.h>
static pa_context *context = NULL;
static pa_stream *stream = NULL;
@@ -75,12 +72,12 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {
pa_operation *o;
if (!success) {
- fprintf(stderr, "Failed to drain stream: %s\n", pa_strerror(pa_context_errno(context)));
+ fprintf(stderr, _("Failed to drain stream: %s\n"), pa_strerror(pa_context_errno(context)));
quit(1);
}
if (verbose)
- fprintf(stderr, "Playback stream drained.\n");
+ fprintf(stderr, _("Playback stream drained.\n"));
pa_stream_disconnect(stream);
pa_stream_unref(stream);
@@ -92,7 +89,7 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) {
pa_operation_unref(o);
if (verbose)
- fprintf(stderr, "Draining connection to server.\n");
+ fprintf(stderr, _("Draining connection to server.\n"));
}
}
@@ -139,12 +136,12 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
case PA_STREAM_READY:
if (verbose)
- fprintf(stderr, "Stream successfully created\n");
+ fprintf(stderr, _("Stream successfully created\n"));
break;
case PA_STREAM_FAILED:
default:
- fprintf(stderr, "Stream errror: %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
+ fprintf(stderr, _("Stream errror: %s\n"), pa_strerror(pa_context_errno(pa_stream_get_context(s))));
quit(1);
}
}
@@ -165,7 +162,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
assert(c && !stream);
if (verbose)
- fprintf(stderr, "Connection established.\n");
+ fprintf(stderr, _("Connection established.\n"));
stream = pa_stream_new(c, stream_name, &sample_spec, channel_map_set ? &channel_map : NULL);
assert(stream);
@@ -183,7 +180,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_FAILED:
default:
- fprintf(stderr, "Connection failure: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Connection failure: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
}
}
@@ -191,14 +188,14 @@ static void context_state_callback(pa_context *c, void *userdata) {
/* UNIX signal to quit recieved */
static void exit_signal_callback(pa_mainloop_api*m, pa_signal_event *e, int sig, void *userdata) {
if (verbose)
- fprintf(stderr, "Got SIGINT, exiting.\n");
+ fprintf(stderr, _("Got SIGINT, exiting.\n"));
quit(0);
}
static void help(const char *argv0) {
- printf("%s [options] [FILE]\n\n"
+ printf(_("%s [options] [FILE]\n\n"
" -h, --help Show this help\n"
" --version Show version\n\n"
" -v, --verbose Enable verbose operation\n\n"
@@ -207,7 +204,7 @@ static void help(const char *argv0) {
" -n, --client-name=NAME How to call this client on the server\n"
" --stream-name=NAME How to call this stream on the server\n"
" --volume=VOLUME Specify the initial (linear) volume in range 0...65536\n"
- " --channel-map=CHANNELMAP Set the channel map to the use\n",
+ " --channel-map=CHANNELMAP Set the channel map to the use\n"),
argv0);
}
@@ -239,6 +236,7 @@ int main(int argc, char *argv[]) {
};
setlocale(LC_ALL, "");
+ bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
if (!(bn = strrchr(argv[0], '/')))
bn = argv[0];
@@ -254,7 +252,8 @@ int main(int argc, char *argv[]) {
goto quit;
case ARG_VERSION:
- printf("paplay "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version());
+ printf(_("paplay %s\nCompiled with libpulse %s\n"
+ "Linked with libpulse %s\n"), PACKAGE_VERSION, pa_get_headers_version(), pa_get_library_version());
ret = 0;
goto quit;
@@ -290,7 +289,7 @@ int main(int argc, char *argv[]) {
case ARG_CHANNELMAP:
if (!pa_channel_map_parse(&channel_map, optarg)) {
- fprintf(stderr, "Invalid channel map\n");
+ fprintf(stderr, _("Invalid channel map\n"));
goto quit;
}
@@ -312,7 +311,7 @@ int main(int argc, char *argv[]) {
sndfile = sf_open_fd(STDIN_FILENO, SFM_READ, &sfinfo, 0);
if (!sndfile) {
- fprintf(stderr, "Failed to open file '%s'\n", filename);
+ fprintf(stderr, _("Failed to open file '%s'\n"), filename);
goto quit;
}
@@ -348,7 +347,7 @@ int main(int argc, char *argv[]) {
assert(pa_sample_spec_valid(&sample_spec));
if (channel_map_set && channel_map.channels != sample_spec.channels) {
- fprintf(stderr, "Channel map doesn't match file.\n");
+ fprintf(stderr, _("Channel map doesn't match file.\n"));
goto quit;
}
@@ -374,12 +373,12 @@ int main(int argc, char *argv[]) {
if (verbose) {
char t[PA_SAMPLE_SPEC_SNPRINT_MAX];
pa_sample_spec_snprint(t, sizeof(t), &sample_spec);
- fprintf(stderr, "Using sample spec '%s'\n", t);
+ fprintf(stderr, _("Using sample spec '%s'\n"), t);
}
/* Set up a new main loop */
if (!(m = pa_mainloop_new())) {
- fprintf(stderr, "pa_mainloop_new() failed.\n");
+ fprintf(stderr, _("pa_mainloop_new() failed.\n"));
goto quit;
}
@@ -394,7 +393,7 @@ int main(int argc, char *argv[]) {
/* Create a new connection context */
if (!(context = pa_context_new(mainloop_api, client_name))) {
- fprintf(stderr, "pa_context_new() failed.\n");
+ fprintf(stderr, _("pa_context_new() failed.\n"));
goto quit;
}
@@ -405,7 +404,7 @@ int main(int argc, char *argv[]) {
/* Run the main loop */
if (pa_mainloop_run(m, &ret) < 0) {
- fprintf(stderr, "pa_mainloop_run() failed.\n");
+ fprintf(stderr, _("pa_mainloop_run() failed.\n"));
goto quit;
}
diff --git a/src/utils/pasuspender.c b/src/utils/pasuspender.c
index 5b4885d..8a59d5e 100644
--- a/src/utils/pasuspender.c
+++ b/src/utils/pasuspender.c
@@ -35,20 +35,16 @@
#include <stdlib.h>
#include <limits.h>
#include <getopt.h>
-
-#include <sndfile.h>
+#include <locale.h>
#ifdef __linux__
#include <sys/prctl.h>
#endif
+#include <pulse/i18n.h>
#include <pulse/pulseaudio.h>
#include <pulsecore/macro.h>
-#if PA_API_VERSION < 10
-#error Invalid PulseAudio API version
-#endif
-
#define BUFSIZE 1024
static pa_context *context = NULL;
@@ -82,7 +78,7 @@ static void start_child(void) {
if ((child_pid = fork()) < 0) {
- fprintf(stderr, "fork(): %s\n", strerror(errno));
+ fprintf(stderr, _("fork(): %s\n"), strerror(errno));
quit(1);
} else if (child_pid == 0) {
@@ -93,7 +89,7 @@ static void start_child(void) {
#endif
if (execvp(child_argv[0], child_argv) < 0)
- fprintf(stderr, "execvp(): %s\n", strerror(errno));
+ fprintf(stderr, _("execvp(): %s\n"), strerror(errno));
_exit(1);
@@ -110,7 +106,7 @@ static void suspend_complete(pa_context *c, int success, void *userdata) {
n++;
if (!success) {
- fprintf(stderr, "Failure to suspend: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failure to suspend: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -125,7 +121,7 @@ static void resume_complete(pa_context *c, int success, void *userdata) {
n++;
if (!success) {
- fprintf(stderr, "Failure to resume: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Failure to resume: %s\n"), pa_strerror(pa_context_errno(c)));
quit(1);
return;
}
@@ -148,7 +144,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
pa_operation_unref(pa_context_suspend_sink_by_index(c, PA_INVALID_INDEX, 1, suspend_complete, NULL));
pa_operation_unref(pa_context_suspend_source_by_index(c, PA_INVALID_INDEX, 1, suspend_complete, NULL));
} else {
- fprintf(stderr, "WARNING: Sound server is not local, not suspending.\n");
+ fprintf(stderr, _("WARNING: Sound server is not local, not suspending.\n"));
start_child();
}
@@ -160,7 +156,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_FAILED:
default:
- fprintf(stderr, "Connection failure: %s\n", pa_strerror(pa_context_errno(c)));
+ fprintf(stderr, _("Connection failure: %s\n"), pa_strerror(pa_context_errno(c)));
pa_context_unref(context);
context = NULL;
@@ -177,7 +173,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
}
static void sigint_callback(pa_mainloop_api *m, pa_signal_event *e, int sig, void *userdata) {
- fprintf(stderr, "Got SIGINT, exiting.\n");
+ fprintf(stderr, _("Got SIGINT, exiting.\n"));
quit(0);
}
@@ -195,7 +191,7 @@ static void sigchld_callback(pa_mainloop_api *m, pa_signal_event *e, int sig, vo
if (WIFEXITED(status))
child_ret = WEXITSTATUS(status);
else if (WIFSIGNALED(status)) {
- fprintf(stderr, "WARNING: Child process terminated by signal %u\n", WTERMSIG(status));
+ fprintf(stderr, _("WARNING: Child process terminated by signal %u\n"), WTERMSIG(status));
child_ret = 1;
}
@@ -213,10 +209,10 @@ static void sigchld_callback(pa_mainloop_api *m, pa_signal_event *e, int sig, vo
static void help(const char *argv0) {
- printf("%s [options] ... \n\n"
+ printf(_("%s [options] ... \n\n"
" -h, --help Show this help\n"
" --version Show version\n"
- " -s, --server=SERVER The name of the server to connect to\n\n",
+ " -s, --server=SERVER The name of the server to connect to\n\n"),
argv0);
}
@@ -236,6 +232,9 @@ int main(int argc, char *argv[]) {
{NULL, 0, NULL, 0}
};
+ setlocale(LC_ALL, "");
+ bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
+
if (!(bn = strrchr(argv[0], '/')))
bn = argv[0];
else
@@ -249,7 +248,12 @@ int main(int argc, char *argv[]) {
goto quit;
case ARG_VERSION:
- printf("pasuspender "PACKAGE_VERSION"\nCompiled with libpulse %s\nLinked with libpulse %s\n", pa_get_headers_version(), pa_get_library_version());
+ printf(_("pasuspender %s\n"
+ "Compiled with libpulse %s\n"
+ "Linked with libpulse %s\n"),
+ PACKAGE_VERSION,
+ pa_get_headers_version(),
+ pa_get_library_version());
ret = 0;
goto quit;
@@ -273,7 +277,7 @@ int main(int argc, char *argv[]) {
}
if (!(m = pa_mainloop_new())) {
- fprintf(stderr, "pa_mainloop_new() failed.\n");
+ fprintf(stderr, _("pa_mainloop_new() failed.\n"));
goto quit;
}
@@ -286,7 +290,7 @@ int main(int argc, char *argv[]) {
#endif
if (!(context = pa_context_new(mainloop_api, bn))) {
- fprintf(stderr, "pa_context_new() failed.\n");
+ fprintf(stderr, _("pa_context_new() failed.\n"));
goto quit;
}
@@ -294,7 +298,7 @@ int main(int argc, char *argv[]) {
pa_context_connect(context, server, PA_CONTEXT_NOAUTOSPAWN, NULL);
if (pa_mainloop_run(m, &ret) < 0) {
- fprintf(stderr, "pa_mainloop_run() failed.\n");
+ fprintf(stderr, _("pa_mainloop_run() failed.\n"));
goto quit;
}
diff --git a/src/utils/pax11publish.c b/src/utils/pax11publish.c
index eee7b6a..50d621d 100644
--- a/src/utils/pax11publish.c
+++ b/src/utils/pax11publish.c
@@ -27,11 +27,13 @@
#include <getopt.h>
#include <string.h>
#include <assert.h>
+#include <locale.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <pulse/util.h>
+#include <pulse/i18n.h>
#include <pulsecore/core-util.h>
#include <pulsecore/log.h>
@@ -47,17 +49,20 @@ int main(int argc, char *argv[]) {
Display *d = NULL;
enum { DUMP, EXPORT, IMPORT, REMOVE } mode = DUMP;
+ setlocale(LC_ALL, "");
+ bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
+
while ((c = getopt(argc, argv, "deiD:S:O:I:c:hr")) != -1) {
switch (c) {
case 'D' :
dname = optarg;
break;
case 'h':
- printf("%s [-D display] [-S server] [-O sink] [-I source] [-c file] [-d|-e|-i|-r]\n\n"
+ printf(_("%s [-D display] [-S server] [-O sink] [-I source] [-c file] [-d|-e|-i|-r]\n\n"
" -d Show current PulseAudio data attached to X11 display (default)\n"
" -e Export local PulseAudio data to X11 display\n"
" -i Import PulseAudio data from X11 display to local environment variables and cookie file.\n"
- " -r Remove PulseAudio data from X11 display\n",
+ " -r Remove PulseAudio data from X11 display\n"),
pa_path_get_filename(argv[0]));
ret = 0;
goto finish;
@@ -86,13 +91,13 @@ int main(int argc, char *argv[]) {
server = optarg;
break;
default:
- fprintf(stderr, "Failed to parse command line.\n");
+ fprintf(stderr, _("Failed to parse command line.\n"));
goto finish;
}
}
if (!(d = XOpenDisplay(dname))) {
- pa_log("XOpenDisplay() failed");
+ pa_log(_("XOpenDisplay() failed"));
goto finish;
}
@@ -100,13 +105,13 @@ int main(int argc, char *argv[]) {
case DUMP: {
char t[1024];
if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t)))
- printf("Server: %s\n", t);
+ printf(_("Server: %s\n"), t);
if (pa_x11_get_prop(d, "PULSE_SOURCE", t, sizeof(t)))
- printf("Source: %s\n", t);
+ printf(_("Source: %s\n"), t);
if (pa_x11_get_prop(d, "PULSE_SINK", t, sizeof(t)))
- printf("Sink: %s\n", t);
+ printf(_("Sink: %s\n"), t);
if (pa_x11_get_prop(d, "PULSE_COOKIE", t, sizeof(t)))
- printf("Cookie: %s\n", t);
+ printf(_("Cookie: %s\n"), t);
break;
}
@@ -124,12 +129,12 @@ int main(int argc, char *argv[]) {
uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
size_t l;
if ((l = pa_parsehex(t, cookie, sizeof(cookie))) != sizeof(cookie)) {
- fprintf(stderr, "Failed to parse cookie data\n");
+ fprintf(stderr, _("Failed to parse cookie data\n"));
goto finish;
}
if (pa_authkey_save(cookie_file, cookie, l) < 0) {
- fprintf(stderr, "Failed to save cookie data\n");
+ fprintf(stderr, _("Failed to save cookie data\n"));
goto finish;
}
}
@@ -144,12 +149,12 @@ int main(int argc, char *argv[]) {
assert(conf);
if (pa_client_conf_load(conf, NULL) < 0) {
- fprintf(stderr, "Failed to load client configuration file.\n");
+ fprintf(stderr, _("Failed to load client configuration file.\n"));
goto finish;
}
if (pa_client_conf_env(conf) < 0) {
- fprintf(stderr, "Failed to read environment configuration data.\n");
+ fprintf(stderr, _("Failed to read environment configuration data.\n"));
goto finish;
}
@@ -166,7 +171,7 @@ int main(int argc, char *argv[]) {
else {
char hn[256];
if (!pa_get_fqdn(hn, sizeof(hn))) {
- fprintf(stderr, "Failed to get FQDN.\n");
+ fprintf(stderr, _("Failed to get FQDN.\n"));
goto finish;
}
@@ -186,7 +191,7 @@ int main(int argc, char *argv[]) {
pa_client_conf_free(conf);
if (pa_authkey_load_auto(cookie_file, cookie, sizeof(cookie)) < 0) {
- fprintf(stderr, "Failed to load cookie data\n");
+ fprintf(stderr, _("Failed to load cookie data\n"));
goto finish;
}
@@ -203,7 +208,7 @@ int main(int argc, char *argv[]) {
break;
default:
- fprintf(stderr, "No yet implemented.\n");
+ fprintf(stderr, _("Not yet implemented.\n"));
goto finish;
}
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list