mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 06:48:17 +00:00
build: install *.mo into the "standard" directory
Change POROJECT_NAME to 'nvim', and use it as the gettext domain name. The *.mo files, previously installed as $runtime/lang/xx/LC_MESSAGES/nvim.mo, are now installed as $prefix/locale/xx/LC_MESSAGES/nvim.mo.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.7)
|
cmake_minimum_required(VERSION 2.8.7)
|
||||||
project(NEOVIM)
|
project(nvim)
|
||||||
|
|
||||||
# Point CMake at any custom modules we may ship
|
# Point CMake at any custom modules we may ship
|
||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
@@ -12,6 +12,9 @@
|
|||||||
#define ARCH_32
|
#define ARCH_32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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
|
||||||
#cmakedefine HAVE_FSEEKO
|
#cmakedefine HAVE_FSEEKO
|
||||||
|
@@ -657,6 +657,9 @@ 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
|
||||||
|
bindtextdomain(PROJECT_NAME, LOCALE_INSTALL_DIR);
|
||||||
|
# else // old vim style: $runtime/lang
|
||||||
{
|
{
|
||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
@@ -665,11 +668,12 @@ static void init_locale(void)
|
|||||||
p = (char_u *)vim_getenv("VIMRUNTIME");
|
p = (char_u *)vim_getenv("VIMRUNTIME");
|
||||||
if (p != NULL && *p != NUL) {
|
if (p != NULL && *p != NUL) {
|
||||||
vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p);
|
vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p);
|
||||||
bindtextdomain(VIMPACKAGE, (char *)NameBuff);
|
bindtextdomain(PROJECT_NAME, (char *)NameBuff);
|
||||||
}
|
}
|
||||||
xfree(p);
|
xfree(p);
|
||||||
textdomain(VIMPACKAGE);
|
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
|
textdomain(PROJECT_NAME);
|
||||||
TIME_MSG("locale set");
|
TIME_MSG("locale set");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -571,8 +571,8 @@ char_u * mb_init(void)
|
|||||||
#ifdef HAVE_WORKING_LIBINTL
|
#ifdef HAVE_WORKING_LIBINTL
|
||||||
/* GNU gettext 0.10.37 supports this feature: set the codeset used for
|
/* GNU gettext 0.10.37 supports this feature: set the codeset used for
|
||||||
* translated messages independently from the current locale. */
|
* translated messages independently from the current locale. */
|
||||||
(void)bind_textdomain_codeset(VIMPACKAGE,
|
(void)bind_textdomain_codeset(PROJECT_NAME,
|
||||||
enc_utf8 ? "utf-8" : (char *)p_enc);
|
enc_utf8 ? "utf-8" : (char *)p_enc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -742,15 +742,15 @@ char_u * home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET
|
|||||||
void vim_setenv(const char *name, const char *val)
|
void vim_setenv(const char *name, const char *val)
|
||||||
{
|
{
|
||||||
os_setenv(name, val, 1);
|
os_setenv(name, val, 1);
|
||||||
/*
|
#ifndef LOCALE_INSTALL_DIR
|
||||||
* When setting $VIMRUNTIME adjust the directory to find message
|
// When setting $VIMRUNTIME adjust the directory to find message
|
||||||
* translations to $VIMRUNTIME/lang.
|
// translations to $VIMRUNTIME/lang.
|
||||||
*/
|
|
||||||
if (*val != NUL && STRICMP(name, "VIMRUNTIME") == 0) {
|
if (*val != NUL && STRICMP(name, "VIMRUNTIME") == 0) {
|
||||||
char *buf = (char *)concat_str((char_u *)val, (char_u *)"/lang");
|
char *buf = (char *)concat_str((char_u *)val, (char_u *)"/lang");
|
||||||
bindtextdomain(VIMPACKAGE, buf);
|
bindtextdomain(PROJECT_NAME, buf);
|
||||||
xfree(buf);
|
xfree(buf);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -72,8 +72,8 @@ if(HAVE_WORKING_LIBINTL AND GETTEXT_FOUND AND XGETTEXT_PRG AND ICONV_PRG)
|
|||||||
|
|
||||||
install_helper(
|
install_helper(
|
||||||
FILES ${moFile}
|
FILES ${moFile}
|
||||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/lang/${name}/LC_MESSAGES
|
DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${name}/LC_MESSAGES
|
||||||
RENAME nvim.mo)
|
RENAME ${PROJECT_NAME}.mo)
|
||||||
|
|
||||||
list(APPEND LANGUAGE_MO_FILES ${moFile})
|
list(APPEND LANGUAGE_MO_FILES ${moFile})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
@@ -27,12 +27,6 @@ Error: configure did not run properly.Check auto/config.log.
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Can't use "PACKAGE" here, conflicts with a Perl include file. */
|
|
||||||
#ifndef VIMPACKAGE
|
|
||||||
# define VIMPACKAGE "nvim"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "nvim/os/os_defs.h" /* bring lots of system header files */
|
#include "nvim/os/os_defs.h" /* bring lots of system header files */
|
||||||
|
|
||||||
/// length of a buffer to store a number in ASCII (64 bits binary + NUL)
|
/// length of a buffer to store a number in ASCII (64 bits binary + NUL)
|
||||||
|
Reference in New Issue
Block a user