Commit 53f5e9af authored by Dan Winship's avatar Dan Winship

libnm*: fix library gettext usage

Libraries need to include <gi18n-lib.h>, not <gi18n.h>, so that _()
will get defined to "dgettext (GETTEXT_DOMAIN, string)" rather than
"gettext (string)" (which will use the program's default domain, which
works fine for programs in the NetworkManager tree, but not for
external users). Likewise, we need to call bindtextdomain() so that
gettext can find the translations if the library is installed in a
different prefix from the program using it (and
bind_textdomain_codeset(), so it will know the translations are in
UTF-8 even if the locale isn't).

(The fact that no one noticed this was broken before is because the
libraries didn't really start returning useful translated strings much
until 0.9.10, and none of the out-of-tree clients have been updated to
actually show those strings to users yet.)
parent 3bfb163a
......@@ -5,6 +5,7 @@ SUBDIRS = . tests
AM_CPPFLAGS = \
-I${top_srcdir}/include \
-DG_LOG_DOMAIN=\""libnm"\" \
-DLOCALEDIR=\"$(datadir)/locale\" \
-DNETWORKMANAGER_COMPILATION \
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
$(GLIB_CFLAGS)
......
......@@ -28,7 +28,7 @@
#include <strings.h>
#include <unistd.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "crypto.h"
#include "nm-errors.h"
......
......@@ -24,7 +24,7 @@
#include "config.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <gcrypt.h>
#include <gnutls/gnutls.h>
......
......@@ -24,7 +24,7 @@
#include "config.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <prinit.h>
#include <nss.h>
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <glib-object.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <string.h>
#include "nm-connection.h"
#include "nm-connection-private.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-8021x.h"
#include "nm-utils.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-adsl.h"
#include "nm-setting-ppp.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <net/ethernet.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-bluetooth.h"
#include "nm-setting-cdma.h"
......
......@@ -26,7 +26,7 @@
#include <errno.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-bond.h"
#include "nm-utils.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-bridge-port.h"
#include "nm-utils.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-bridge.h"
#include "nm-connection-private.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-cdma.h"
#include "nm-utils.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-utils.h"
#include "nm-utils-private.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-dcb.h"
#include "nm-utils.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-gsm.h"
#include "nm-utils.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-infiniband.h"
#include "nm-utils.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <arpa/inet.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-ip-config.h"
#include "nm-setting-ip4-config.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-ip4-config.h"
#include "nm-setting-private.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-ip6-config.h"
#include "nm-setting-private.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-olpc-mesh.h"
#include "nm-dbus-interface.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-ppp.h"
#include "nm-setting-private.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-pppoe.h"
#include "nm-setting-ppp.h"
......
......@@ -23,7 +23,7 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-team-port.h"
#include "nm-utils.h"
......
......@@ -22,7 +22,7 @@
#include <string.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-team.h"
#include "nm-utils.h"
......
......@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-vlan.h"
#include "nm-utils.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-vpn.h"
#include "nm-utils.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <net/ethernet.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-wimax.h"
#include "nm-setting-private.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <net/ethernet.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-wired.h"
#include "nm-utils.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-wireless-security.h"
#include "nm-setting-8021x.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <net/ethernet.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-wireless.h"
#include "nm-dbus-interface.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include "nm-setting.h"
......
......@@ -26,6 +26,7 @@
#include <netinet/ether.h>
#include <arpa/inet.h>
#include <uuid/uuid.h>
#include <libintl.h>
#include <gmodule.h>
#include "nm-utils.h"
......@@ -242,6 +243,9 @@ nm_utils_init (GError **error)
if (!initialized) {
initialized = TRUE;
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
if (!crypto_init (error))
return FALSE;
......
......@@ -23,7 +23,7 @@
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <gudev/gudev.h>
#include "NetworkManager.h"
......
......@@ -23,7 +23,7 @@
#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <NetworkManager.h>
#include <nm-utils.h>
......
......@@ -6,6 +6,7 @@ AM_CPPFLAGS = \
-I${top_srcdir} \
-I${top_srcdir}/include \
-DG_LOG_DOMAIN=\""libnm-util"\" \
-DLOCALEDIR=\"$(datadir)/locale\" \
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
......
......@@ -28,7 +28,7 @@
#include <strings.h>
#include <unistd.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "crypto.h"
......
......@@ -24,7 +24,7 @@
#include "config.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <gcrypt.h>
#include <gnutls/gnutls.h>
......
......@@ -24,7 +24,7 @@
#include "config.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <prinit.h>
#include <nss.h>
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <glib-object.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <dbus/dbus-glib.h>
#include <string.h>
#include "nm-connection.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-8021x.h"
#include "nm-param-spec-specialized.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-adsl.h"
#include "nm-setting-ppp.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <net/ethernet.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-param-spec-specialized.h"
#include "nm-dbus-glib-types.h"
......
......@@ -27,7 +27,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-bond.h"
#include "nm-param-spec-specialized.h"
......
......@@ -25,7 +25,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-bridge-port.h"
#include "nm-utils.h"
......
......@@ -25,7 +25,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include <linux/if_ether.h>
#include "nm-setting-bridge.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-cdma.h"
#include "nm-utils.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-utils.h"
#include "nm-dbus-glib-types.h"
......
......@@ -23,7 +23,7 @@
#include <string.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-dcb.h"
#include "nm-param-spec-specialized.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-gsm.h"
#include "nm-utils.h"
......
......@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <dbus/dbus-glib.h>
#include <linux/if_infiniband.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-infiniband.h"
#include "nm-param-spec-specialized.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-ip4-config.h"
#include "nm-param-spec-specialized.h"
......
......@@ -23,7 +23,7 @@
#include <string.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-ip6-config.h"
#include "nm-param-spec-specialized.h"
......
......@@ -25,7 +25,7 @@
#include <string.h>
#include <netinet/ether.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "NetworkManager.h"
#include "nm-setting-olpc-mesh.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-ppp.h"
#include "nm-setting-private.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-pppoe.h"
#include "nm-setting-ppp.h"
......
......@@ -24,7 +24,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-team-port.h"
#include "nm-utils.h"
......
......@@ -23,7 +23,7 @@
#include <string.h>
#include <stdlib.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-team.h"
#include "nm-param-spec-specialized.h"
......
......@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-vlan.h"
#include "nm-param-spec-specialized.h"
......
......@@ -25,7 +25,7 @@
#include <errno.h>
#include <stdlib.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-vpn.h"
#include "nm-param-spec-specialized.h"
......
......@@ -25,7 +25,7 @@
#include <string.h>
#include <net/ethernet.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-wimax.h"
#include "nm-param-spec-specialized.h"
......
......@@ -26,7 +26,7 @@
#include <net/ethernet.h>
#include <netinet/ether.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-wired.h"
#include "nm-param-spec-specialized.h"
......
......@@ -24,7 +24,7 @@
#include <string.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting-wireless-security.h"
#include "nm-setting-8021x.h"
......
......@@ -26,7 +26,7 @@
#include <net/ethernet.h>
#include <netinet/ether.h>
#include <dbus/dbus-glib.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "NetworkManager.h"
#include "nm-setting-wireless.h"
......
......@@ -23,7 +23,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-setting.h"
#include "nm-setting-private.h"
......
......@@ -26,6 +26,7 @@
#include <netinet/ether.h>
#include <linux/if_infiniband.h>
#include <uuid/uuid.h>
#include <libintl.h>
#include <gmodule.h>
#include "nm-utils.h"
......@@ -234,6 +235,9 @@ nm_utils_init (GError **error)
if (!initialized) {
initialized = TRUE;
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
if (!crypto_init (error))
return FALSE;
......
......@@ -29,7 +29,7 @@
#include "nm-setting-connection.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
G_DEFINE_TYPE (NMDeviceAdsl, nm_device_adsl, NM_TYPE_DEVICE)
......
......@@ -21,7 +21,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-glib-compat.h"
......
......@@ -21,7 +21,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-glib-compat.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-glib-compat.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-glib-compat.h"
......
......@@ -21,7 +21,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-device-generic.h"
#include "nm-device-private.h"
......
......@@ -21,7 +21,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-glib-compat.h"
......
......@@ -22,7 +22,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-glib-compat.h"
......
......@@ -21,7 +21,7 @@
#include "config.h"
#include <string.h>
#include <glib/gi18n.h>
#include <glib/gi18n-lib.h>
#include "nm-glib-compat.h"
......
......@@ -21,7 +21,7 @@
#include "config.h"
#include <string.h>