diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-04-20 13:48:44 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-04-20 13:48:44 (EDT) |
commit | 6caeaa42afda39d10997c097b99b450795c54aab (patch) | |
tree | 3cd7c5458c166faa263f4d7587f1407b197e38d5 | |
parent | b6c6ab68e3f34f8a3c768a5f00a7dec7867b01b1 (diff) |
main: Set text domain and locale
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | src/main.c | 16 |
2 files changed, 15 insertions, 2 deletions
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) \ @@ -17,6 +17,11 @@ * along with opkg-opk. If not, see <http://www.gnu.org/licenses/>. */ +#include "config.h" + +#ifdef ENABLE_NLS +#include <locale.h> +#endif #include <stdio.h> #include <stdlib.h> #include "defs.h" @@ -24,8 +29,6 @@ #include "opk.h" #include "ustar.h" -#include "config.h" - #ifdef HAVE_GETOPT_LONG #include <getopt.h> #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; |