diff options
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r-- | src/nvim/ex_cmds2.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 950a1a436f..2821074b0d 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3627,6 +3627,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 @@ -3667,6 +3675,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 "; } } @@ -3711,7 +3723,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) { @@ -3726,7 +3738,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(); } @@ -3811,12 +3823,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. |