aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 6bb3c37b92..e7c45b1a7b 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -237,7 +237,7 @@ int main(int argc, char **argv)
char **argv = xmalloc((size_t)argc * sizeof(char *));
for (int i = 0; i < argc; i++) {
char *buf = NULL;
- utf16_to_utf8(argv_w[i], &buf);
+ utf16_to_utf8(argv_w[i], -1, &buf);
assert(buf);
argv[i] = buf;
}
@@ -396,8 +396,7 @@ int main(int argc, char **argv)
mch_exit(0);
}
- // Set a few option defaults after reading vimrc files: 'title', 'icon',
- // 'shellpipe', 'shellredir'.
+ // Set some option defaults after reading vimrc files.
set_init_3();
TIME_MSG("inits 3");
@@ -707,22 +706,14 @@ 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);
- }
-# endif
+ char localepath[MAXPATHL] = { 0 };
+ snprintf(localepath, sizeof(localepath), "%s", get_vim_var_str(VV_PROGPATH));
+ char *tail = (char *)path_tail_with_sep((char_u *)localepath);
+ *tail = NUL;
+ tail = (char *)path_tail((char_u *)localepath);
+ xstrlcpy(tail, "share/locale",
+ sizeof(localepath) - (size_t)(tail - localepath));
+ bindtextdomain(PROJECT_NAME, localepath);
textdomain(PROJECT_NAME);
TIME_MSG("locale set");
}