[pulseaudio-discuss] [PATCH 3/3] Move i18n.[ch] to src/pulsecore

Maarten Bosmans mkbosmans at gmail.com
Wed Aug 10 01:30:15 PDT 2011


The header is used in files troughout the tree and is not included in the public api,
so it belongs in pulsecore, not in pulse.
---
 src/Makefile.am                                 |    4 +-
 src/daemon/caps.c                               |    3 +-
 src/daemon/cmdline.c                            |    2 +-
 src/daemon/daemon-conf.c                        |    2 +-
 src/daemon/dumpmodules.c                        |    4 +-
 src/daemon/ltdl-bind-now.c                      |    3 +-
 src/daemon/main.c                               |    2 +-
 src/modules/alsa/alsa-mixer.c                   |    2 +-
 src/modules/alsa/alsa-sink.c                    |    2 +-
 src/modules/alsa/alsa-source.c                  |    2 +-
 src/modules/alsa/alsa-util.c                    |    2 +-
 src/modules/alsa/module-alsa-card.c             |    2 +-
 src/modules/bluetooth/module-bluetooth-device.c |    2 +-
 src/modules/echo-cancel/module-echo-cancel.c    |    2 +-
 src/modules/module-always-sink.c                |    4 +-
 src/modules/module-equalizer-sink.c             |    2 +-
 src/modules/module-filter-apply.c               |    6 +-
 src/modules/module-ladspa-sink.c                |    2 +-
 src/modules/module-null-sink.c                  |    2 +-
 src/modules/module-rygel-media-server.c         |    2 +-
 src/modules/module-virtual-sink.c               |    2 +-
 src/modules/module-virtual-source.c             |    2 +-
 src/modules/reserve-wrap.c                      |    2 +-
 src/pulse/channelmap.c                          |    2 +-
 src/pulse/client-conf-x11.c                     |    2 +-
 src/pulse/client-conf.c                         |    2 +-
 src/pulse/context.c                             |    2 +-
 src/pulse/error.c                               |    3 +-
 src/pulse/format.c                              |    2 +-
 src/pulse/i18n.c                                |   38 --------------
 src/pulse/i18n.h                                |   62 -----------------------
 src/pulse/mainloop-api.c                        |    2 +-
 src/pulse/mainloop-signal.c                     |    2 +-
 src/pulse/mainloop.c                            |    2 +-
 src/pulse/sample.c                              |    2 +-
 src/pulse/thread-mainloop.c                     |    2 +-
 src/pulse/volume.c                              |    3 +-
 src/pulsecore/i18n.c                            |   38 ++++++++++++++
 src/pulsecore/i18n.h                            |   61 ++++++++++++++++++++++
 src/pulsecore/lock-autospawn.c                  |    2 +-
 src/pulsecore/sink.c                            |    2 +-
 src/tests/resampler-test.c                      |    2 +-
 src/utils/pacat.c                               |    5 +-
 src/utils/pacmd.c                               |    2 +-
 src/utils/pactl.c                               |    2 +-
 src/utils/pasuspender.c                         |    3 +-
 src/utils/pax11publish.c                        |    2 +-
 47 files changed, 150 insertions(+), 153 deletions(-)
 delete mode 100644 src/pulse/i18n.c
 delete mode 100644 src/pulse/i18n.h
 create mode 100644 src/pulsecore/i18n.c
 create mode 100644 src/pulsecore/i18n.h

diff --git a/src/Makefile.am b/src/Makefile.am
index ebf5ebc..6b775e5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -523,7 +523,6 @@ lib_LTLIBRARIES = \
 
 libpulsecommon_ at PA_MAJORMINOR@_la_SOURCES = \
 		pulse/client-conf.c pulse/client-conf.h \
-		pulse/i18n.c pulse/i18n.h \
 		pulse/fork-detect.c pulse/fork-detect.h \
 		pulse/xmalloc.c pulse/xmalloc.h \
 		pulse/proplist.c pulse/proplist.h \
@@ -545,11 +544,12 @@ libpulsecommon_ at PA_MAJORMINOR@_la_SOURCES = \
 		pulsecore/endianmacros.h \
 		pulsecore/flist.c pulsecore/flist.h \
 		pulsecore/hashmap.c pulsecore/hashmap.h \
+		pulsecore/i18n.c pulsecore/i18n.h \
 		pulsecore/idxset.c pulsecore/idxset.h \
 		pulsecore/arpa-inet.c pulsecore/arpa-inet.h \
 		pulsecore/iochannel.c pulsecore/iochannel.h \
 		pulsecore/ioline.c pulsecore/ioline.h \
-		pulsecore/ipacl.h pulsecore/ipacl.c \
+		pulsecore/ipacl.c pulsecore/ipacl.h \
 		pulsecore/llist.h \
 		pulsecore/lock-autospawn.c pulsecore/lock-autospawn.h \
 		pulsecore/log.c pulsecore/log.h \
diff --git a/src/daemon/caps.c b/src/daemon/caps.c
index 74ccb1c..3759388 100644
--- a/src/daemon/caps.c
+++ b/src/daemon/caps.c
@@ -28,8 +28,7 @@
 #include <errno.h>
 #include <sys/types.h>
 
-#include <pulse/i18n.h>
-
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/log.h>
 
diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c
index ec37d46..d42f90d 100644
--- a/src/daemon/cmdline.c
+++ b/src/daemon/cmdline.c
@@ -28,10 +28,10 @@
 #include <getopt.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 #include <pulse/util.h>
 
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/strbuf.h>
 #include <pulsecore/macro.h>
 
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index bb92909..1f70b09 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -37,11 +37,11 @@
 
 #include <pulse/xmalloc.h>
 #include <pulse/timeval.h>
-#include <pulse/i18n.h>
 #include <pulse/version.h>
 
 #include <pulsecore/core-error.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/strbuf.h>
 #include <pulsecore/conf-parser.h>
 #include <pulsecore/resampler.h>
diff --git a/src/daemon/dumpmodules.c b/src/daemon/dumpmodules.c
index 68ab5bb..009fbe5 100644
--- a/src/daemon/dumpmodules.c
+++ b/src/daemon/dumpmodules.c
@@ -29,11 +29,11 @@
 #include <ltdl.h>
 
 #include <pulse/util.h>
-#include <pulse/i18n.h>
 
-#include <pulsecore/modinfo.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
+#include <pulsecore/modinfo.h>
 
 #include "dumpmodules.h"
 
diff --git a/src/daemon/ltdl-bind-now.c b/src/daemon/ltdl-bind-now.c
index 2ba73ce..605a3e2 100644
--- a/src/daemon/ltdl-bind-now.c
+++ b/src/daemon/ltdl-bind-now.c
@@ -36,8 +36,7 @@
 
 #include <ltdl.h>
 
-#include <pulse/i18n.h>
-
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/log.h>
 
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 94c87d1..55726fd 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -66,8 +66,8 @@
 #include <pulse/mainloop-signal.h>
 #include <pulse/timeval.h>
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/lock-autospawn.h>
 #include <pulsecore/socket.h>
 #include <pulsecore/core-error.h>
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 4542ac3..4c64573 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -38,9 +38,9 @@
 #include <pulse/util.h>
 #include <pulse/volume.h>
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 #include <pulse/utf8.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index c1655d4..c6bbc46 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -32,13 +32,13 @@
 #include <valgrind/memcheck.h>
 #endif
 
-#include <pulse/i18n.h>
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
 #include <pulse/volume.h>
 #include <pulse/xmalloc.h>
 
 #include <pulsecore/core.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/module.h>
 #include <pulsecore/memchunk.h>
 #include <pulsecore/sink.h>
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 6b6f513..c51e9bd 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -28,13 +28,13 @@
 
 #include <asoundlib.h>
 
-#include <pulse/i18n.h>
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
 #include <pulse/volume.h>
 #include <pulse/xmalloc.h>
 
 #include <pulsecore/core.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/module.h>
 #include <pulsecore/memchunk.h>
 #include <pulsecore/sink.h>
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 883c26f..602e9a3 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -31,9 +31,9 @@
 #include <pulse/xmalloc.h>
 #include <pulse/timeval.h>
 #include <pulse/util.h>
-#include <pulse/i18n.h>
 #include <pulse/utf8.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index e60aa5e..8b19d42 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -24,9 +24,9 @@
 #endif
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/modargs.h>
 #include <pulsecore/queue.h>
 
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 9f81336..efbc144 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -28,12 +28,12 @@
 #include <linux/sockios.h>
 #include <arpa/inet.h>
 
-#include <pulse/i18n.h>
 #include <pulse/rtclock.h>
 #include <pulse/sample.h>
 #include <pulse/timeval.h>
 #include <pulse/xmalloc.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/module.h>
 #include <pulsecore/modargs.h>
 #include <pulsecore/core-rtclock.h>
diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 961f289..704228e 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -35,10 +35,10 @@
 #include "echo-cancel.h"
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 #include <pulse/timeval.h>
 #include <pulse/rtclock.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/atomic.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/namereg.h>
diff --git a/src/modules/module-always-sink.c b/src/modules/module-always-sink.c
index 4c871da..5d9ee63 100644
--- a/src/modules/module-always-sink.c
+++ b/src/modules/module-always-sink.c
@@ -24,13 +24,13 @@
 #endif
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
 #include <pulsecore/core.h>
+#include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/sink.h>
 #include <pulsecore/modargs.h>
 #include <pulsecore/log.h>
-#include <pulsecore/core-util.h>
 
 #include "module-always-sink-symdef.h"
 
diff --git a/src/modules/module-equalizer-sink.c b/src/modules/module-equalizer-sink.c
index ee9b678..7161c05 100644
--- a/src/modules/module-equalizer-sink.c
+++ b/src/modules/module-equalizer-sink.c
@@ -46,10 +46,10 @@
 #include <fftw3.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 #include <pulse/timeval.h>
 
 #include <pulsecore/core-rtclock.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/aupdate.h>
 #include <pulsecore/namereg.h>
 #include <pulsecore/sink.h>
diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c
index c742373..bf5d0c5 100644
--- a/src/modules/module-filter-apply.c
+++ b/src/modules/module-filter-apply.c
@@ -25,14 +25,14 @@
 
 #include <pulse/timeval.h>
 #include <pulse/rtclock.h>
-#include <pulse/i18n.h>
 #include <pulse/xmalloc.h>
 
+#include <pulsecore/core.h>
+#include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/hashmap.h>
 #include <pulsecore/hook-list.h>
-#include <pulsecore/core.h>
-#include <pulsecore/core-util.h>
 #include <pulsecore/sink-input.h>
 #include <pulsecore/modargs.h>
 
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index 9b4903a..7a60403 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -29,8 +29,8 @@
 #include <math.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/namereg.h>
 #include <pulsecore/sink.h>
 #include <pulsecore/module.h>
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index 09e6ab7..10868f5 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -31,8 +31,8 @@
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/sink.h>
 #include <pulsecore/module.h>
diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c
index 1856835..9af0ceb 100644
--- a/src/modules/module-rygel-media-server.c
+++ b/src/modules/module-rygel-media-server.c
@@ -30,9 +30,9 @@
 
 #include <pulse/gccmacro.h>
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 #include <pulse/utf8.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/sink.h>
 #include <pulsecore/source.h>
 #include <pulsecore/core-util.h>
diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c
index 0a410e4..34c4ae8 100644
--- a/src/modules/module-virtual-sink.c
+++ b/src/modules/module-virtual-sink.c
@@ -29,8 +29,8 @@
 
 #include <pulse/gccmacro.h>
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/namereg.h>
 #include <pulsecore/sink.h>
 #include <pulsecore/module.h>
diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c
index b7f6982..70e327b 100644
--- a/src/modules/module-virtual-source.c
+++ b/src/modules/module-virtual-source.c
@@ -27,8 +27,8 @@
 #include <stdio.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/namereg.h>
 #include <pulsecore/sink.h>
diff --git a/src/modules/reserve-wrap.c b/src/modules/reserve-wrap.c
index 515cb22..1411d27 100644
--- a/src/modules/reserve-wrap.c
+++ b/src/modules/reserve-wrap.c
@@ -26,10 +26,10 @@
 #include <errno.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
 #include <pulsecore/core-error.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/shared.h>
 
 #ifdef HAVE_DBUS
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 83fdb43..0d199f3 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -29,8 +29,8 @@
 #include <string.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/bitset.h>
diff --git a/src/pulse/client-conf-x11.c b/src/pulse/client-conf-x11.c
index 76b1b7b..76b9f6f 100644
--- a/src/pulse/client-conf-x11.c
+++ b/src/pulse/client-conf-x11.c
@@ -28,8 +28,8 @@
 #include <xcb/xcb.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/x11prop.h>
 #include <pulsecore/log.h>
 #include <pulsecore/core-util.h>
diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
index e899af1..e2c2aae 100644
--- a/src/pulse/client-conf.c
+++ b/src/pulse/client-conf.c
@@ -29,8 +29,8 @@
 #include <errno.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-error.h>
 #include <pulsecore/log.h>
diff --git a/src/pulse/context.c b/src/pulse/context.c
index e8f3032..1d974ad 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -44,7 +44,6 @@
 #include <pulse/version.h>
 #include <pulse/xmalloc.h>
 #include <pulse/util.h>
-#include <pulse/i18n.h>
 #include <pulse/mainloop.h>
 #include <pulse/timeval.h>
 #include <pulse/fork-detect.h>
@@ -54,6 +53,7 @@
 #endif
 
 #include <pulsecore/core-error.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/native-common.h>
 #include <pulsecore/pdispatch.h>
 #include <pulsecore/pstream.h>
diff --git a/src/pulse/error.c b/src/pulse/error.c
index 19a759c..eb5082a 100644
--- a/src/pulse/error.c
+++ b/src/pulse/error.c
@@ -29,7 +29,8 @@
 #include <stdlib.h>
 
 #include <pulse/def.h>
-#include <pulse/i18n.h>
+
+#include <pulsecore/i18n.h>
 
 #include "error.h"
 
diff --git a/src/pulse/format.c b/src/pulse/format.c
index b256d72..81c329f 100644
--- a/src/pulse/format.c
+++ b/src/pulse/format.c
@@ -29,9 +29,9 @@
 
 #include <pulse/internal.h>
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 
 #include "format.h"
diff --git a/src/pulse/i18n.c b/src/pulse/i18n.c
deleted file mode 100644
index 7f25b20..0000000
--- a/src/pulse/i18n.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/***
-  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
deleted file mode 100644
index fac3c7b..0000000
--- a/src/pulse/i18n.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#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/version.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 c1f7604..45539cc 100644
--- a/src/pulse/mainloop-api.c
+++ b/src/pulse/mainloop-api.c
@@ -26,8 +26,8 @@
 #include <stdlib.h>
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 
 #include "mainloop-api.h"
diff --git a/src/pulse/mainloop-signal.c b/src/pulse/mainloop-signal.c
index 393d1f7..9482fe3 100644
--- a/src/pulse/mainloop-signal.c
+++ b/src/pulse/mainloop-signal.c
@@ -36,10 +36,10 @@
 #endif
 
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
 #include <pulsecore/core-error.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 
diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 3ef387b..8e956c9 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -34,7 +34,6 @@
 #include <pulsecore/pipe.h>
 #endif
 
-#include <pulse/i18n.h>
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
 #include <pulse/xmalloc.h>
@@ -42,6 +41,7 @@
 #include <pulsecore/poll.h>
 #include <pulsecore/core-rtclock.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/llist.h>
 #include <pulsecore/log.h>
 #include <pulsecore/core-error.h>
diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 8365e93..b613612 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -28,9 +28,9 @@
 #include <string.h>
 
 #include <pulse/timeval.h>
-#include <pulse/i18n.h>
 
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 
 #include "sample.h"
diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c
index b07ad78..aa56a92 100644
--- a/src/pulse/thread-mainloop.c
+++ b/src/pulse/thread-mainloop.c
@@ -33,8 +33,8 @@
 
 #include <pulse/xmalloc.h>
 #include <pulse/mainloop.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/log.h>
 #include <pulsecore/thread.h>
 #include <pulsecore/mutex.h>
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 82e5757..cf0a226 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -27,9 +27,8 @@
 #include <string.h>
 #include <math.h>
 
-#include <pulse/i18n.h>
-
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/sample-util.h>
 
diff --git a/src/pulsecore/i18n.c b/src/pulsecore/i18n.c
new file mode 100644
index 0000000..7f25b20
--- /dev/null
+++ b/src/pulsecore/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/pulsecore/i18n.h b/src/pulsecore/i18n.h
new file mode 100644
index 0000000..d828bec
--- /dev/null
+++ b/src/pulsecore/i18n.h
@@ -0,0 +1,61 @@
+#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>
+
+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/pulsecore/lock-autospawn.c b/src/pulsecore/lock-autospawn.c
index 40aa5e9..b1d414b 100644
--- a/src/pulsecore/lock-autospawn.c
+++ b/src/pulsecore/lock-autospawn.c
@@ -32,9 +32,9 @@
 #endif
 
 #include <pulse/gccmacro.h>
-#include <pulse/i18n.h>
 #include <pulse/xmalloc.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/poll.h>
 #include <pulsecore/mutex.h>
 #include <pulsecore/thread.h>
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 714b3d2..42a8eb3 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -34,10 +34,10 @@
 #include <pulse/xmalloc.h>
 #include <pulse/timeval.h>
 #include <pulse/util.h>
-#include <pulse/i18n.h>
 #include <pulse/rtclock.h>
 #include <pulse/internal.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/sink-input.h>
 #include <pulsecore/namereg.h>
 #include <pulsecore/core-util.h>
diff --git a/src/tests/resampler-test.c b/src/tests/resampler-test.c
index 78461da..545c0e0 100644
--- a/src/tests/resampler-test.c
+++ b/src/tests/resampler-test.c
@@ -25,13 +25,13 @@
 #include <getopt.h>
 #include <locale.h>
 
-#include <pulse/i18n.h>
 #include <pulse/pulseaudio.h>
 
 #include <pulse/rtclock.h>
 #include <pulse/sample.h>
 #include <pulse/volume.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/resampler.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/endianmacros.h>
diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index 323f071..f687402 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -37,15 +37,14 @@
 
 #include <sndfile.h>
 
-#include <pulse/i18n.h>
 #include <pulse/pulseaudio.h>
 #include <pulse/rtclock.h>
 
-#include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/log.h>
+#include <pulsecore/macro.h>
 #include <pulsecore/sndfile-util.h>
-#include <pulsecore/core-util.h>
 
 #define TIME_EVENT_USEC 50000
 
diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c
index f077980..4166964 100644
--- a/src/utils/pacmd.c
+++ b/src/utils/pacmd.c
@@ -34,8 +34,8 @@
 
 #include <pulse/util.h>
 #include <pulse/xmalloc.h>
-#include <pulse/i18n.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/poll.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index e6f9c17..38c78a8 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -35,9 +35,9 @@
 
 #include <sndfile.h>
 
-#include <pulse/i18n.h>
 #include <pulse/pulseaudio.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/log.h>
diff --git a/src/utils/pasuspender.c b/src/utils/pasuspender.c
index e1ee251..90881b2 100644
--- a/src/utils/pasuspender.c
+++ b/src/utils/pasuspender.c
@@ -40,8 +40,9 @@
 #include <sys/prctl.h>
 #endif
 
-#include <pulse/i18n.h>
 #include <pulse/pulseaudio.h>
+
+#include <pulsecore/i18n.h>
 #include <pulsecore/macro.h>
 
 static pa_context *context = NULL;
diff --git a/src/utils/pax11publish.c b/src/utils/pax11publish.c
index 41361a1..ddfb724 100644
--- a/src/utils/pax11publish.c
+++ b/src/utils/pax11publish.c
@@ -31,10 +31,10 @@
 #include <xcb/xcb.h>
 
 #include <pulse/util.h>
-#include <pulse/i18n.h>
 #include <pulse/client-conf.h>
 
 #include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
 #include <pulsecore/log.h>
 #include <pulsecore/authkey.h>
 #include <pulsecore/native-common.h>
-- 
1.7.4.1



More information about the pulseaudio-discuss mailing list