From 4258e248d070baff6bdc8d03a3be8ec2f8d20552 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 15 Aug 2021 17:52:54 +0200 Subject: [PATCH] [gettext] Show info about gettext. gettext (System) means gettext from the libc library. gettext (ELinks) builtin from src/intl/gettext. --- src/intl/gettext/libintl.c | 22 ++++++++++++++++++++++ src/intl/libintl.c | 21 +++++++++++++++++++++ src/intl/libintl.h | 3 +++ src/main/module.c | 6 ++++++ 4 files changed, 52 insertions(+) diff --git a/src/intl/gettext/libintl.c b/src/intl/gettext/libintl.c index 39047ab90..7b6318623 100644 --- a/src/intl/gettext/libintl.c +++ b/src/intl/gettext/libintl.c @@ -222,3 +222,25 @@ set_language(int language) _nl_msg_cat_cntr++; } } + +static void +init_gettext(struct module *module) +{ +} + +static void +done_gettext(struct module *module) +{ + mem_free_set(&LANGUAGE, NULL); +} + +struct module gettext_module = struct_module( + /* name: */ "gettext (ELinks)", + /* options: */ NULL, + /* hooks: */ NULL, + /* submodules: */ NULL, + /* data: */ NULL, + /* init: */ init_gettext, + /* done: */ done_gettext +); + diff --git a/src/intl/libintl.c b/src/intl/libintl.c index 67c488da9..09921e3ca 100644 --- a/src/intl/libintl.c +++ b/src/intl/libintl.c @@ -221,3 +221,24 @@ set_language(int language) _nl_msg_cat_cntr++; } + +static void +init_gettext(struct module *module) +{ +} + +static void +done_gettext(struct module *module) +{ + mem_free_set(&LANGUAGE, NULL); +} + +struct module gettext_module = struct_module( + /* name: */ "gettext (System)", + /* options: */ NULL, + /* hooks: */ NULL, + /* submodules: */ NULL, + /* data: */ NULL, + /* init: */ init_gettext, + /* done: */ done_gettext +); diff --git a/src/intl/libintl.h b/src/intl/libintl.h index 7f63d74d9..cd1f6ed6a 100644 --- a/src/intl/libintl.h +++ b/src/intl/libintl.h @@ -3,12 +3,15 @@ #include "config/options.h" #include "intl/charsets.h" +#include "main/module.h" #include "terminal/terminal.h" #ifdef __cplusplus extern "C" { #endif +extern struct module gettext_module; + #ifdef CONFIG_GETTEXT extern int _nl_msg_cat_cntr; diff --git a/src/main/module.c b/src/main/module.c index 64aba901e..a3e077acf 100644 --- a/src/main/module.c +++ b/src/main/module.c @@ -24,6 +24,9 @@ #include "ecmascript/ecmascript.h" #include "formhist/formhist.h" #include "globhist/globhist.h" +#ifdef CONFIG_NLS +#include "intl/libintl.h" +#endif #include "mime/mime.h" #include "network/ssl/ssl.h" #include "protocol/protocol.h" @@ -43,6 +46,9 @@ struct module *main_modules[] = { struct module *builtin_modules[] = { &periodic_saving_module, &viewer_module, +#ifdef CONFIG_NLS + &gettext_module, +#endif #ifdef CONFIG_CSS &css_module, #endif