summaryrefslogblamecommitdiff
path: root/user/cracklib/nls.patch
blob: 20d695fc049891d66c941ad6325c166f942bfa4d (plain) (tree)















































                                                                                                                                   
From f0610dec6dafa550c87809d39ea1c43701af4f31 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sat, 26 Nov 2022 19:55:12 -0600
Subject: [PATCH] util: Call bindtextdomain to initialise gettext

This fixes localised message output in the following cases:

* non-standard PREFIX on GNU systems

  GNU systems wouldn't be able to find the message catalog files.

* musl systems

  musl relies on bindtextdomain being called; it has no default catalog
  path.
---
 util/Makefile.am | 2 +-
 util/check.c     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/Makefile.am b/util/Makefile.am
index 4649416..409dc29 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -6,7 +6,7 @@ dist_sbin_SCRIPTS = create-cracklib-dict cracklib-format
 
 LDADD = ../lib/libcrack.la
 
-AM_CPPFLAGS = -I. -I.. -I$(top_srcdir)/lib '-DDEFAULT_CRACKLIB_DICT="$(DEFAULT_CRACKLIB_DICT)"' -Wall
+AM_CPPFLAGS = -I. -I.. -I$(top_srcdir)/lib '-DDEFAULT_CRACKLIB_DICT="$(DEFAULT_CRACKLIB_DICT)"' '-DLOCALEDIR="$(localedir)"' -Wall
 
 cracklib_check_SOURCES = check.c
 cracklib_check_LDADD = $(LDADD) $(LTLIBINTL)
diff --git a/util/check.c b/util/check.c
index 7db0c88..bb8fff5 100644
--- a/util/check.c
+++ b/util/check.c
@@ -24,6 +24,7 @@ main(int argc, char **argv)
 	setlocale(LC_ALL, "");
 
 #ifdef ENABLE_NLS
+	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
 #endif
 
-- 
2.36.0