To: vim-dev@vim.org Subject: Patch 6.0.041 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.041 Problem: Using ":language messages en" when LC_MESSAGES is undefined results in setting LC_CTYPE. (Eric Carlier) Solution: Set $LC_MESSAGES instead. Files: src/ex_cmds2.c *** ../vim60.40/src/ex_cmds2.c Sun Oct 28 21:23:45 2001 --- src/ex_cmds2.c Tue Oct 30 20:32:04 2001 *************** *** 4628,4633 **** --- 4628,4638 ---- char_u *name; int what = LC_ALL; char *whatstr = ""; + #ifdef LC_MESSAGES + # define VIM_LC_MESSAGES LC_MESSAGES + #else + # define VIM_LC_MESSAGES 6789 + #endif name = eap->arg; *************** *** 4639,4649 **** { if (STRNICMP(eap->arg, "messages", p - eap->arg) == 0) { ! #ifdef LC_MESSAGES ! what = LC_MESSAGES; ! #else ! what = LC_CTYPE; ! #endif name = skipwhite(p); whatstr = "messages "; } --- 4644,4650 ---- { if (STRNICMP(eap->arg, "messages", p - eap->arg) == 0) { ! what = VIM_LC_MESSAGES; name = skipwhite(p); whatstr = "messages "; } *************** *** 4663,4674 **** if (*name == NUL) { ! smsg((char_u *)_("Current %slanguage: \"%s\""), ! whatstr, setlocale(what, NULL)); } else { ! loc = setlocale(what, (char *)name); if (loc == NULL) EMSG2(_("E197: Cannot set language to \"%s\""), name); else --- 4664,4695 ---- if (*name == NUL) { ! #ifndef LC_MESSAGES ! if (what == VIM_LC_MESSAGES) ! { ! p = vim_getenv("LC_ALL"); ! if (p == NULL || *p == NUL) ! { ! p = vim_getenv("LC_MESSAGES"); ! if (p == NULL || *p == NUL) ! p = vim_getenv("LANG"); ! } ! } ! else ! #endif ! p = setlocale(what, NULL); ! if (p == NULL || *p == NUL) ! p = "Unknown"; ! smsg((char_u *)_("Current %slanguage: \"%s\""), whatstr, p); } else { ! #ifndef LC_MESSAGES ! if (what == VIM_LC_MESSAGES) ! loc = ""; ! else ! #endif ! loc = setlocale(what, (char *)name); if (loc == NULL) EMSG2(_("E197: Cannot set language to \"%s\""), name); else *************** *** 4697,4705 **** /* Set $LC_CTYPE, because it overrules $LANG, and * gtk_set_locale() calls setlocale() again. gnome_init() * sets $LC_CTYPE to "en_US" (that's a bug!). */ ! #ifdef LC_MESSAGES ! if (what != LC_MESSAGES) ! #endif vim_setenv((char_u *)"LC_CTYPE", name); # ifdef FEAT_GUI_GTK /* Let GTK know what locale we're using. Not sure this is --- 4718,4724 ---- /* Set $LC_CTYPE, because it overrules $LANG, and * gtk_set_locale() calls setlocale() again. gnome_init() * sets $LC_CTYPE to "en_US" (that's a bug!). */ ! if (what != VIM_LC_MESSAGES) vim_setenv((char_u *)"LC_CTYPE", name); # ifdef FEAT_GUI_GTK /* Let GTK know what locale we're using. Not sure this is *** ../vim60.40/src/version.c Tue Oct 30 20:35:08 2001 --- src/version.c Tue Oct 30 20:34:45 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 41, /**/ -- BEDEVERE: Look! It's the old man from scene 24 - what's he Doing here? ARTHUR: He is the keeper of the Bridge. He asks each traveler five questions ... GALAHAD: Three questions. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///