From 6caeaa42afda39d10997c097b99b450795c54aab Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 20 Apr 2023 13:48:44 -0400 Subject: main: Set text domain and locale --- diff --git a/Makefile.am b/Makefile.am index 345cd25..b2d1c4d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,6 +47,7 @@ opkg_opk_CFLAGS = \ $(WARN_CFLAGS) \ $(ASAN_CFLAGS) opkg_opk_CPPFLAGS = \ + -DLOCALEDIR=\"$(localedir)\" \ $(ZLIB_CFLAGS) opkg_opk_LDADD = \ $(ASAN_CFLAGS) \ diff --git a/src/main.c b/src/main.c index 6a98f7b..5a20236 100644 --- a/src/main.c +++ b/src/main.c @@ -17,6 +17,11 @@ * along with opkg-opk. If not, see . */ +#include "config.h" + +#ifdef ENABLE_NLS +#include +#endif #include #include #include "defs.h" @@ -24,8 +29,6 @@ #include "opk.h" #include "ustar.h" -#include "config.h" - #ifdef HAVE_GETOPT_LONG #include #else @@ -149,6 +152,15 @@ main(int argc, char *argv[]) int opt; struct opkg_opk_opk *opk; +#ifdef ENABLE_NLS + bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); +#ifdef HAVE_BIND_TEXTDOMAIN_CODESET + bind_textdomain_codeset(PACKAGE, "UTF-8"); +#endif + textdomain(PACKAGE); + setlocale(LC_ALL, ""); +#endif + program_name = argv[0]; control_files = NULL; list_members = 0; -- cgit v0.9.1