Use proper NLS macros and detection (so the message translation works again).
authorMilan Broz <gmazyland@gmail.com>
Mon, 16 Nov 2009 20:10:20 +0000 (20:10 +0000)
committerMilan Broz <gmazyland@gmail.com>
Mon, 16 Nov 2009 20:10:20 +0000 (20:10 +0000)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@145 36d66b0a-2a48-0410-832c-cd162a569da5

ChangeLog
lib/internal.h
lib/nls.h [new file with mode: 0644]
src/cryptsetup.h

index 20f35ed..34fc724 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
        * Check in configure if selinux libraries are required in static version.
        * Add temporary debug code to find processes locking internal device.
        * Simplify build system, use autopoint and clean gettext processing.
+       * Use proper NLS macros and detection (so the message translation works again).
 
 2009-09-30  Milan Broz  <mbroz@redhat.com>
        * Fix exported symbols and versions in libcryptsetup.
index fe9dfa0..50529c4 100644 (file)
@@ -10,9 +10,7 @@
 #include <unistd.h>
 #include <inttypes.h>
 
-#include <libintl.h>
-#include <locale.h>
-#define _(String) gettext((String))
+#include "nls.h"
 
 #define SECTOR_SHIFT           9
 #define SECTOR_SIZE            (1 << SECTOR_SHIFT)
diff --git a/lib/nls.h b/lib/nls.h
new file mode 100644 (file)
index 0000000..d7a9d9b
--- /dev/null
+++ b/lib/nls.h
@@ -0,0 +1,32 @@
+#ifndef CRYPTSETUP_NLS_H
+#define CRYPTSETUP_NLS_H
+
+#ifndef LOCALEDIR
+#define LOCALEDIR "/usr/share/locale"
+#endif
+
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#else
+# undef setlocale
+# define setlocale(Category, Locale) /* empty */
+#endif
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(Text) gettext (Text)
+# ifdef gettext_noop
+#  define N_(String) gettext_noop (String)
+# else
+#  define N_(String) (String)
+# endif
+#else
+# undef bindtextdomain
+# define bindtextdomain(Domain, Directory) /* empty */
+# undef textdomain
+# define textdomain(Domain) /* empty */
+# define _(Text) (Text)
+# define N_(Text) (Text)
+#endif
+
+#endif /* CRYPTSETUP_H */
index d787f7a..a010252 100644 (file)
@@ -5,26 +5,7 @@
 #      include <config.h>
 #endif
 
-#if HAVE_LOCALE_H
-#      include <locale.h>
-#endif
-#if !HAVE_SETLOCALE
-#      define setlocale(Category, Locale)      do { } while (0)
-#endif
-
-#ifdef ENABLE_NLS
-#      include <libintl.h>
-#      define _(Text) gettext (Text)
-#else
-#      undef bindtextdomain
-#      define bindtextdomain(Domain, Directory)        do { } while (0)
-#      undef textdomain
-#      define textdomain(Domain)       do { } while (0)
-#      undef dcgettext
-#      define dcgettext(Domainname, Text, Category) Text
-#      define _(Text) Text
-#endif
-#define N_(Text) (Text)
+#include "lib/nls.h"
 
 #define DEFAULT_CIPHER         "aes"
 #define DEFAULT_LUKS_CIPHER     "aes-cbc-essiv:sha256"