Commit: patch 9.2.0866: MS-Windows: ":language messages" only works once
Christian Brabandt <[email protected]> Tue, 28 Jul 2026 20:00:06 +0200
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <[email protected]> |
patch 9.2.0866: MS-Windows: ":language messages" only works once Commit: https://github.com/vim/vim/commit/a29d16a3919a12a0e775d50cc67f062c8d7ca33a Author: Hirohito Higashi <[email protected]> Date: Mon Jul 27 21:55:27 2026 +0000 patch 9.2.0866: MS-Windows: ":language messages" only works once Problem: On MS-Windows ":language messages" has no effect once messages have been translated, the previous language keeps being used. Solution: Make gettext drop the translations it cached. related: #18622 closes: #20862 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Hirohito Higashi <[email protected]> Signed-off-by: Christian Brabandt <[email protected]> diff --git a/src/locale.c b/src/locale.c index db2dfa1af..eb1845fce 100644 --- a/src/locale.c +++ b/src/locale.c @@ -348,6 +348,10 @@ ex_language(exarg_T *eap) extern int _nl_msg_cat_cntr; ++_nl_msg_cat_cntr; +# elif defined(DYNAMIC_GETTEXT) + // Same thing when gettext is loaded at runtime. + if (dyn_libintl_nl_msg_cat_cntr != NULL) + ++*dyn_libintl_nl_msg_cat_cntr; # endif // Reset $LC_ALL, otherwise it would overrule everything. vim_setenv((char_u *)"LC_ALL", (char_u *)""); diff --git a/src/os_win32.c b/src/os_win32.c index 4797eed42..53b600f80 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -696,6 +696,7 @@ char *(*dyn_libintl_bindtextdomain)(const char *, const char *) char *(*dyn_libintl_bind_textdomain_codeset)(const char *, const char *) = null_libintl_bind_textdomain_codeset; int (*dyn_libintl_wputenv)(const wchar_t *) = null_libintl_wputenv; +int *dyn_libintl_nl_msg_cat_cntr = NULL; int dyn_libintl_init(void) @@ -770,6 +771,11 @@ dyn_libintl_init(void) if (dyn_libintl_wputenv == NULL || dyn_libintl_wputenv == _wputenv) dyn_libintl_wputenv = null_libintl_wputenv; + // The _nl_msg_cat_cntr variable is optional. It is used to make gettext + // drop the translations it cached. + dyn_libintl_nl_msg_cat_cntr = (int *)GetProcAddress(hLibintlDLL, + "_nl_msg_cat_cntr"); + return 1; } @@ -785,6 +791,7 @@ dyn_libintl_end(void) dyn_libintl_bindtextdomain = null_libintl_bindtextdomain; dyn_libintl_bind_textdomain_codeset = null_libintl_bind_textdomain_codeset; dyn_libintl_wputenv = null_libintl_wputenv; + dyn_libintl_nl_msg_cat_cntr = NULL; } static char * diff --git a/src/version.c b/src/version.c index 3f239da85..48389e931 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 866, /**/ 865, /**/ diff --git a/src/vim.h b/src/vim.h index 408cf711d..0caf43740 100644 --- a/src/vim.h +++ b/src/vim.h @@ -577,6 +577,7 @@ extern char *(*dyn_libintl_bindtextdomain)(const char *domainname, const char *d extern char *(*dyn_libintl_bind_textdomain_codeset)(const char *domainname, const char *codeset); extern char *(*dyn_libintl_textdomain)(const char *domainname); extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); +extern int *dyn_libintl_nl_msg_cat_cntr; #endif -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1wom62-00182R-Ve%40256bit.org.