diff src/version.c @ 14171:ddf160d82971 v8.1.0103

patch 8.1.0103: long version string cannot be translated commit https://github.com/vim/vim/commit/35fb6fbf727c72eb5987a1556bbba26dca14cc48 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 23 16:12:21 2018 +0200 patch 8.1.0103: long version string cannot be translated Problem: Long version string cannot be translated. Solution: Build the string in init_longVersion().
author Christian Brabandt <cb@256bit.org>
date Sat, 23 Jun 2018 16:15:05 +0200
parents 42a9178374d1
children 4b59671bce9c
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -37,7 +37,7 @@ char	longVersion[sizeof(VIM_VERSION_LONG
 						      + sizeof(__TIME__) + 3];
 
     void
-make_version(void)
+init_longVersion(void)
 {
     /*
      * Construct the long version string.  Necessary because
@@ -49,8 +49,25 @@ make_version(void)
     strcat(longVersion, __TIME__);
     strcat(longVersion, ")");
 }
+
 # else
-char	*longVersion = VIM_VERSION_LONG_DATE __DATE__ " " __TIME__ ")";
+    void
+init_longVersion(void)
+{
+    char *date_time = __DATE__ " " __TIME__;
+    char *msg = _("%s (%s, compiled %s)");
+    size_t len = strlen(msg)
+		+ strlen(VIM_VERSION_LONG_ONLY)
+		+ strlen(VIM_VERSION_DATE_ONLY)
+		+ strlen(date_time);
+
+    longVersion = (char *)alloc(len);
+    if (longVersion == NULL)
+	longVersion = VIM_VERSION_LONG;
+    else
+	vim_snprintf(longVersion, len, msg,
+		      VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);
+}
 # endif
 #else
 char	*longVersion = VIM_VERSION_LONG;
@@ -762,6 +779,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    103,
+/**/
     102,
 /**/
     101,
@@ -1148,6 +1167,7 @@ list_version(void)
      * When adding features here, don't forget to update the list of
      * internal variables in eval.c!
      */
+    init_longVersion();
     MSG(longVersion);
 #ifdef WIN3264
 # ifdef FEAT_GUI_W32