# define localeconv() NULL
#endif
+
#ifdef ENABLE_NLS
# include <libintl.h>
-# define _(Text) gettext (Text)
+/*
+ * For NLS support in the public shared libraries we have to specify text
+ * domain name to be independend on the main program. For this purpose define
+ * UL_TEXTDOMAIN_EXPLICIT before you include nls.h to your shared library code.
+ */
+# ifdef UL_TEXTDOMAIN_EXPLICIT
+# define _(Text) dgettext (UL_TEXTDOMAIN_EXPLICIT, Text)
+# else
+# define _(Text) gettext (Text)
+# endif
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define _(Text) (Text)
# define N_(Text) (Text)
# define P_(Singular, Plural, n) ((n) == 1 ? (Singular) : (Plural))
-#endif
+#endif /* ENABLE_NLS */
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#include <errno.h>
#include <sys/param.h>
-#include "nls.h"
#include "blkdev.h"
#include "fdiskP.h"
#include "pt-mbr.h"
cxt->labels[ cxt->nlabels++ ] = fdisk_new_sgi_label(cxt);
cxt->labels[ cxt->nlabels++ ] = fdisk_new_sun_label(cxt);
+ bindtextdomain(LIBFDISK_TEXTDOMAIN, LOCALEDIR);
+
return cxt;
}
* from util-linux fdisk.
*/
#include "c.h"
-#include "nls.h"
#include "randutils.h"
#include "pt-mbr.h"
#include "strutils.h"
#include "c.h"
#include "libfdisk.h"
-#include "nls.h" /* temporary before dialog API will be implemented */
#include "list.h"
#include "debug.h"
#include <stdio.h>
#define ON_DBG(m, x) __UL_DBG_CALL(libfdisk, LIBFDISK_DEBUG_, m, x)
#define DBG_FLUSH __UL_DBG_FLUSH(libfdisk, LIBFDISK_DEBUG_)
+/*
+ * NLS -- the library has to be independent on main program, so define
+ * UL_TEXTDOMAIN_EXPLICIT before you include nls.h.
+ *
+ * Now we use util-linux.po (=PACKAGE), rather than maintain the texts
+ * in the separate libfdisk.po file.
+ */
+#define LIBFDISK_TEXTDOMAIN PACKAGE
+#define UL_TEXTDOMAIN_EXPLICIT LIBFDISK_TEXTDOMAIN
+#include "nls.h"
+
+
#ifdef TEST_PROGRAM
struct fdisk_test {
const char *name;
#include "fdiskP.h"
-#include "nls.h"
#include "crc32.h"
#include "blkdev.h"
#include "bitops.h"
#include <ctype.h>
-#include "nls.h"
#include "fdiskP.h"
/**
*/
#include "c.h"
-#include "nls.h"
#include "all-io.h"
#include "blkdev.h"
#include <unistd.h> /* write */
#include <sys/ioctl.h> /* ioctl */
-#include "nls.h"
#include "blkdev.h"
#include "bitops.h"