forked from aniani/vim
patch 8.1.0512: 'helplang' default is inconsistent for C and C.UTF-8
Problem: 'helplang' default is inconsistent for C and C.UTF-8. Solution: Don't accept a value unless it starts with two letters.
This commit is contained in:
@@ -5358,6 +5358,16 @@ gettext_lang(char_u *name)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_MULTI_LANG) || defined(PROTO)
|
#if defined(FEAT_MULTI_LANG) || defined(PROTO)
|
||||||
|
/*
|
||||||
|
* Return TRUE when "lang" starts with a valid language name.
|
||||||
|
* Rejects NULL, empty string, "C", "C.UTF-8" and others.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
is_valid_mess_lang(char_u *lang)
|
||||||
|
{
|
||||||
|
return lang != NULL && ASCII_ISALPHA(lang[0]) && ASCII_ISALPHA(lang[1]);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Obtain the current messages language. Used to set the default for
|
* Obtain the current messages language. Used to set the default for
|
||||||
* 'helplang'. May return NULL or an empty string.
|
* 'helplang'. May return NULL or an empty string.
|
||||||
@@ -5379,17 +5389,17 @@ get_mess_lang(void)
|
|||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
p = mch_getenv((char_u *)"LC_ALL");
|
p = mch_getenv((char_u *)"LC_ALL");
|
||||||
if (p == NULL || *p == NUL)
|
if (!is_valid_mess_lang(p))
|
||||||
{
|
{
|
||||||
p = mch_getenv((char_u *)"LC_MESSAGES");
|
p = mch_getenv((char_u *)"LC_MESSAGES");
|
||||||
if (p == NULL || *p == NUL)
|
if (!is_valid_mess_lang(p))
|
||||||
p = mch_getenv((char_u *)"LANG");
|
p = mch_getenv((char_u *)"LANG");
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef WIN32
|
# ifdef WIN32
|
||||||
p = gettext_lang(p);
|
p = gettext_lang(p);
|
||||||
# endif
|
# endif
|
||||||
return p;
|
return is_valid_mess_lang(p) ? p : NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -792,6 +792,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
512,
|
||||||
/**/
|
/**/
|
||||||
511,
|
511,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user