From f1d2bf84089b1e5b5988a5e5d6d571a507a52337 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 6 Aug 2008 18:54:13 +0200 Subject: add i18n support --- src/utils/pacmd.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/utils/pacmd.c') diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c index 67d95252..24cddaa3 100644 --- a/src/utils/pacmd.c +++ b/src/utils/pacmd.c @@ -31,10 +31,12 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -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: -- cgit