aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-06-07 13:07:02 +0900
committererw7 <erw7.github@gmail.com>2019-06-09 13:28:10 +0900
commit1fbc01f4ab7c652b26f96fe19936f5f8e1f38e45 (patch)
treeb238b08f9f891cc0e30c9c6069a51fd61731ca10 /src/nvim/main.c
parent2d6e44087734a39b5e0f2789bcd68e1a4526955f (diff)
downloadrneovim-1fbc01f4ab7c652b26f96fe19936f5f8e1f38e45.tar.gz
rneovim-1fbc01f4ab7c652b26f96fe19936f5f8e1f38e45.tar.bz2
rneovim-1fbc01f4ab7c652b26f96fe19936f5f8e1f38e45.zip
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.
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 8ff873e127..e0d3c1e9be 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -712,22 +712,18 @@ static void init_locale(void)
setlocale(LC_NUMERIC, "C");
# endif
-# ifdef LOCALE_INSTALL_DIR // gnu/linux standard: $prefix/share/locale
- bindtextdomain(PROJECT_NAME, LOCALE_INSTALL_DIR);
-# else // old vim style: $runtime/lang
- {
- char_u *p;
-
- // 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);
+ char localepath[MAXPATHL] = { 0 };
+ char *exepath = localepath;
+ size_t exepathlen = MAXPATHL;
+ if (os_exepath(exepath, &exepathlen) != 0) {
+ path_guess_exepath(argv0 ? argv0 : "nvim", exepath, sizeof(exepath));
}
-# 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);
TIME_MSG("locale set");
}