Merge pull request #14403 from seandewar/vim-8.2.1933

vim-patch:8.2.{0174,1933,1935,1946,2286,2287}
This commit is contained in:
Jan Edmund Lazo
2021-05-09 17:08:21 -04:00
committed by GitHub
20 changed files with 551 additions and 22 deletions

View File

@@ -3621,6 +3621,14 @@ void set_lang_var(void)
loc = get_locale_val(LC_TIME);
# endif
set_vim_var_string(VV_LC_TIME, loc, -1);
# ifdef HAVE_GET_LOCALE_VAL
loc = get_locale_val(LC_COLLATE);
# else
// setlocale() not supported: use the default value
loc = "C";
# endif
set_vim_var_string(VV_COLLATE, loc, -1);
}
#ifdef HAVE_WORKING_LIBINTL
@@ -3661,6 +3669,10 @@ void ex_language(exarg_T *eap)
what = LC_TIME;
name = skipwhite(p);
whatstr = "time ";
} else if (STRNICMP(eap->arg, "collate", p - eap->arg) == 0) {
what = LC_COLLATE;
name = skipwhite(p);
whatstr = "collate ";
}
}
@@ -3705,7 +3717,7 @@ void ex_language(exarg_T *eap)
// Reset $LC_ALL, otherwise it would overrule everything.
os_setenv("LC_ALL", "", 1);
if (what != LC_TIME) {
if (what != LC_TIME && what != LC_COLLATE) {
// Tell gettext() what to translate to. It apparently doesn't
// use the currently effective locale.
if (what == LC_ALL) {
@@ -3720,7 +3732,7 @@ void ex_language(exarg_T *eap)
}
}
// Set v:lang, v:lc_time and v:ctype to the final result.
// Set v:lang, v:lc_time, v:collate and v:ctype to the final result.
set_lang_var();
maketitle();
}
@@ -3805,12 +3817,15 @@ char_u *get_lang_arg(expand_T *xp, int idx)
if (idx == 2) {
return (char_u *)"time";
}
if (idx == 3) {
return (char_u *)"collate";
}
init_locales();
if (locales == NULL) {
return NULL;
}
return locales[idx - 3];
return locales[idx - 4];
}
/// Function given to ExpandGeneric() to obtain the available locales.