add i18n support

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

View file

@ -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: