mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 08:18:17 +00:00
Fix problems with message catalog directory
- In appimage, the message catalog is not used because there is no message catalog in LOCALE_INSTALL_DIR. Therefore, change to exepath/../share/locale instead of LOCALE_INSTALL_DIR. - The old vim style($runtime/lang) is no longer used. Thus all relevant code is removed.
This commit is contained in:
@@ -13,7 +13,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PROJECT_NAME "@PROJECT_NAME@"
|
#define PROJECT_NAME "@PROJECT_NAME@"
|
||||||
#define LOCALE_INSTALL_DIR "@CMAKE_INSTALL_FULL_LOCALEDIR@"
|
|
||||||
|
|
||||||
#cmakedefine HAVE__NSGETENVIRON
|
#cmakedefine HAVE__NSGETENVIRON
|
||||||
#cmakedefine HAVE_FD_CLOEXEC
|
#cmakedefine HAVE_FD_CLOEXEC
|
||||||
|
@@ -1890,7 +1890,7 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
vim_setenv(name, p);
|
os_setenv(name, p, 1);
|
||||||
if (STRICMP(name, "HOME") == 0) {
|
if (STRICMP(name, "HOME") == 0) {
|
||||||
init_homedir();
|
init_homedir();
|
||||||
} else if (didset_vim && STRICMP(name, "VIM") == 0) {
|
} else if (didset_vim && STRICMP(name, "VIM") == 0) {
|
||||||
|
@@ -2821,10 +2821,10 @@ void ex_packadd(exarg_T *eap)
|
|||||||
/// ":options"
|
/// ":options"
|
||||||
void ex_options(exarg_T *eap)
|
void ex_options(exarg_T *eap)
|
||||||
{
|
{
|
||||||
vim_setenv("OPTWIN_CMD", cmdmod.tab ? "tab" : "");
|
os_setenv("OPTWIN_CMD", cmdmod.tab ? "tab" : "", 1);
|
||||||
vim_setenv("OPTWIN_CMD",
|
os_setenv("OPTWIN_CMD",
|
||||||
cmdmod.tab ? "tab" :
|
cmdmod.tab ? "tab" :
|
||||||
(cmdmod.split & WSP_VERT) ? "vert" : "");
|
(cmdmod.split & WSP_VERT) ? "vert" : "", 1);
|
||||||
cmd_source((char_u *)SYS_OPTWIN_FILE, NULL);
|
cmd_source((char_u *)SYS_OPTWIN_FILE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3916,19 +3916,19 @@ void ex_language(exarg_T *eap)
|
|||||||
_nl_msg_cat_cntr++;
|
_nl_msg_cat_cntr++;
|
||||||
#endif
|
#endif
|
||||||
// Reset $LC_ALL, otherwise it would overrule everything.
|
// Reset $LC_ALL, otherwise it would overrule everything.
|
||||||
vim_setenv("LC_ALL", "");
|
os_setenv("LC_ALL", "", 1);
|
||||||
|
|
||||||
if (what != LC_TIME) {
|
if (what != LC_TIME) {
|
||||||
// Tell gettext() what to translate to. It apparently doesn't
|
// Tell gettext() what to translate to. It apparently doesn't
|
||||||
// use the currently effective locale.
|
// use the currently effective locale.
|
||||||
if (what == LC_ALL) {
|
if (what == LC_ALL) {
|
||||||
vim_setenv("LANG", (char *)name);
|
os_setenv("LANG", (char *)name, 1);
|
||||||
|
|
||||||
// Clear $LANGUAGE because GNU gettext uses it.
|
// Clear $LANGUAGE because GNU gettext uses it.
|
||||||
vim_setenv("LANGUAGE", "");
|
os_setenv("LANGUAGE", "", 1);
|
||||||
}
|
}
|
||||||
if (what != LC_CTYPE) {
|
if (what != LC_CTYPE) {
|
||||||
vim_setenv("LC_MESSAGES", (char *)name);
|
os_setenv("LC_MESSAGES", (char *)name, 1);
|
||||||
set_helplang_default((char *)name);
|
set_helplang_default((char *)name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -712,22 +712,18 @@ static void init_locale(void)
|
|||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef LOCALE_INSTALL_DIR // gnu/linux standard: $prefix/share/locale
|
char localepath[MAXPATHL] = { 0 };
|
||||||
bindtextdomain(PROJECT_NAME, LOCALE_INSTALL_DIR);
|
char *exepath = localepath;
|
||||||
# else // old vim style: $runtime/lang
|
size_t exepathlen = MAXPATHL;
|
||||||
{
|
if (os_exepath(exepath, &exepathlen) != 0) {
|
||||||
char_u *p;
|
path_guess_exepath(argv0 ? argv0 : "nvim", exepath, sizeof(exepath));
|
||||||
|
|
||||||
// expand_env() doesn't work yet, because g_chartab[] is not
|
|
||||||
// initialized yet, call vim_getenv() directly
|
|
||||||
p = (char_u *)vim_getenv("VIMRUNTIME");
|
|
||||||
if (p != NULL && *p != NUL) {
|
|
||||||
vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p);
|
|
||||||
bindtextdomain(PROJECT_NAME, (char *)NameBuff);
|
|
||||||
}
|
|
||||||
xfree(p);
|
|
||||||
}
|
}
|
||||||
# endif
|
char *tail = (char *)path_tail_with_sep((char_u *)exepath);
|
||||||
|
*tail = NUL;
|
||||||
|
tail = (char *)path_tail((char_u *)exepath);
|
||||||
|
xstrlcpy(tail, "share/locale",
|
||||||
|
sizeof(localepath) - (size_t)(tail - localepath));
|
||||||
|
bindtextdomain(PROJECT_NAME, localepath);
|
||||||
textdomain(PROJECT_NAME);
|
textdomain(PROJECT_NAME);
|
||||||
TIME_MSG("locale set");
|
TIME_MSG("locale set");
|
||||||
}
|
}
|
||||||
|
@@ -2598,11 +2598,11 @@ did_set_string_option(
|
|||||||
} else if (varp == &p_hf) { // 'helpfile'
|
} else if (varp == &p_hf) { // 'helpfile'
|
||||||
// May compute new values for $VIM and $VIMRUNTIME
|
// May compute new values for $VIM and $VIMRUNTIME
|
||||||
if (didset_vim) {
|
if (didset_vim) {
|
||||||
vim_setenv("VIM", "");
|
os_setenv("VIM", "", 1);
|
||||||
didset_vim = false;
|
didset_vim = false;
|
||||||
}
|
}
|
||||||
if (didset_vimruntime) {
|
if (didset_vimruntime) {
|
||||||
vim_setenv("VIMRUNTIME", "");
|
os_setenv("VIMRUNTIME", "", 1);
|
||||||
didset_vimruntime = false;
|
didset_vimruntime = false;
|
||||||
}
|
}
|
||||||
} else if (varp == &curwin->w_p_cc) { // 'colorcolumn'
|
} else if (varp == &curwin->w_p_cc) { // 'colorcolumn'
|
||||||
@@ -6744,7 +6744,7 @@ void vimrc_found(char_u *fname, char_u *envname)
|
|||||||
// Set $MYVIMRC to the first vimrc file found.
|
// Set $MYVIMRC to the first vimrc file found.
|
||||||
p = FullName_save((char *)fname, false);
|
p = FullName_save((char *)fname, false);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
vim_setenv((char *)envname, p);
|
os_setenv((char *)envname, p, 1);
|
||||||
xfree(p);
|
xfree(p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -805,10 +805,10 @@ char *vim_getenv(const char *name)
|
|||||||
// next time, and others can also use it (e.g. Perl).
|
// next time, and others can also use it (e.g. Perl).
|
||||||
if (vim_path != NULL) {
|
if (vim_path != NULL) {
|
||||||
if (vimruntime) {
|
if (vimruntime) {
|
||||||
vim_setenv("VIMRUNTIME", vim_path);
|
os_setenv("VIMRUNTIME", vim_path, 1);
|
||||||
didset_vimruntime = true;
|
didset_vimruntime = true;
|
||||||
} else {
|
} else {
|
||||||
vim_setenv("VIM", vim_path);
|
os_setenv("VIM", vim_path, 1);
|
||||||
didset_vim = true;
|
didset_vim = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -955,22 +955,6 @@ char_u * home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET
|
|||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Vim setenv() wrapper with special handling for $VIMRUNTIME to keep the
|
|
||||||
/// localization machinery sane.
|
|
||||||
void vim_setenv(const char *name, const char *val)
|
|
||||||
{
|
|
||||||
os_setenv(name, val, 1);
|
|
||||||
#ifndef LOCALE_INSTALL_DIR
|
|
||||||
// When setting $VIMRUNTIME adjust the directory to find message
|
|
||||||
// translations to $VIMRUNTIME/lang.
|
|
||||||
if (*val != NUL && STRICMP(name, "VIMRUNTIME") == 0) {
|
|
||||||
char *buf = (char *)concat_str((char_u *)val, (char_u *)"/lang");
|
|
||||||
bindtextdomain(PROJECT_NAME, buf);
|
|
||||||
xfree(buf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Function given to ExpandGeneric() to obtain an environment variable name.
|
/// Function given to ExpandGeneric() to obtain an environment variable name.
|
||||||
char_u *get_env_name(expand_T *xp, int idx)
|
char_u *get_env_name(expand_T *xp, int idx)
|
||||||
|
Reference in New Issue
Block a user