patch 9.1.0559: translation of vim scripts can be improved

Problem:  translation of vim scripts can be improved
          (after v9.1.0509)
Solution: improve documentation, add tests, include missing
          libraries for the Windows CI
          (RestorerZ)

closes: #15100

Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/po/Make_all.mak b/src/po/Make_all.mak
index c3e6459..ac11228 100644
--- a/src/po/Make_all.mak
+++ b/src/po/Make_all.mak
@@ -189,8 +189,8 @@
 	../../runtime/defaults.vim
 
 PO_VIM_JSLIST = \
-	________runtime__optwin.js \
-	________runtime__defaults.js
+	optwin.js \
+	defaults.js
 
 # Arguments for xgettext to pick up messages to translate from the source code.
 XGETTEXT_KEYWORDS = --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 --keyword=PLURAL_MSG:2,4
diff --git a/src/po/Make_mvc.mak b/src/po/Make_mvc.mak
index d56adb0..174908a 100644
--- a/src/po/Make_mvc.mak
+++ b/src/po/Make_mvc.mak
@@ -40,7 +40,9 @@
 PACKAGE = vim
 # Correct the following line for the where executeable file vim is
 # installed.  Please do not put the path in quotes.
+!IFNDEF VIMPROG
 VIMPROG = ..\vim.exe
+!ENDIF
 
 # Correct the following line for the directory where gettext et al is
 # installed.  Please do not put the path in quotes.
@@ -498,25 +500,26 @@
 first_time: files
 	"$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).po \
 		$(PO_VIM_INPUTLIST)
+	@ copy /a .\files+.\vim_to_js .\allfiles
 	set OLD_PO_FILE_INPUT=yes
 	set OLD_PO_FILE_OUTPUT=yes
 	$(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments $(XGETTEXT_KEYWORDS) \
-		--files-from=.\files $(PO_VIM_JSLIST)
+		--files-from=.\allfiles
 	"$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).po \
 		$(PO_VIM_INPUTLIST)
-	$(RM) *.js
+	$(RM) *.js .\vim_to_js
 
 $(PACKAGE).pot: files
 	"$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \
 		$(PO_VIM_INPUTLIST)
+	@ copy /a .\files+.\vim_to_js .\allfiles
 	set OLD_PO_FILE_INPUT=yes
 	set OLD_PO_FILE_OUTPUT=yes
-	$(XGETTEXT) --default-domain=$(PACKAGE) --add-comments $(XGETTEXT_KEYWORDS) \
-		--files-from=.\files $(PO_VIM_JSLIST)
-	$(MV) $(PACKAGE).po $(PACKAGE).pot
+	$(XGETTEXT) --default-domain=$(PACKAGE) --output=$(PACKAGE).pot \
+		--add-comments $(XGETTEXT_KEYWORDS) --files-from=.\allfiles
 	"$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \
 		$(PO_VIM_INPUTLIST)
-	$(RM) *.js
+	$(RM) *.js .\vim_to_js
 
 # Only original translations with default encoding should be updated.
 # The files that are converted to a different encoding clearly state "DO NOT EDIT".
@@ -546,11 +549,34 @@
 cleanup-po-all: $(POFILES)
 	!"$(VIMPROG)" -u NONE -e -X -S cleanup.vim -c wq $**
 
+#######
+# For translations of plug-ins
+#######
+
+# Preparing the POT file of the plug-in package
+POT_PLUGPACKAGE_PATH = $(MAKEDIR)
+$(PLUGPACKAGE).pot : $(PO_PLUG_INPUTLIST)
+	"$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim \
+		$(PLUGPACKAGE).pot $**
+	$(XGETTEXT) --from-code=UTF-8 --default-domain=$(PLUGPACKAGE) \
+		--package-name=$(PLUGPACKAGE) \
+		--output-dir="$(POT_PLUGPACKAGE_PATH)" \
+		--output=$(PLUGPACKAGE).pot --files-from=.\vim_to_js
+	"$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim \
+		"$(POT_PLUGPACKAGE_PATH)\$(PLUGPACKAGE).pot" $**
+	$(RM) *.js .\vim_to_js
+
+# Converting the PO file of the plug-in package to the binary format of the MO file
+MO_PLUGPACKAGE_PATH = $(MAKEDIR)
+$(PLUGPACKAGE).mo : $(PO_PLUGPACKAGE)
+	$(MSGFMT) -o $(MO_PLUGPACKAGE_PATH)\$@ $?
+
+
 clean: checkclean
 	$(RM) *.mo
 	$(RM) *.pot
 	$(RM) *.orig
-	$(RM) files
+	$(RM) files allfiles
 	$(RM) sjiscorr.obj sjiscorr.exe
 #	$(RM) big5corr.obj big5corr.exe
 
diff --git a/src/po/Makefile b/src/po/Makefile
index eebb7ed..0f7f85d 100644
--- a/src/po/Makefile
+++ b/src/po/Makefile
@@ -1,18 +1,17 @@
 # Makefile for the Vim message translations.
-PO_BASEDIR = .
 
 # Include stuff found by configure.
-include $(PO_BASEDIR)/../auto/config.mk
+include ../auto/config.mk
 
 # Get LANGUAGES, MOFILES, MOCONVERTED and others.
-include $(PO_BASEDIR)/Make_all.mak
+include Make_all.mak
 
 # Note: ja.sjis, *.cp1250 and zh_CN.cp936 are only for MS-Windows, they are
 # not installed on Unix.
 
 PACKAGE = vim
 SHELL = /bin/sh
-VIMPROG = $(PO_BASEDIR)/../vim
+VIMPROG = ../vim
 
 # MacOS sed is locale aware, set $LANG to avoid problems.
 SED = LANG=C sed
@@ -41,8 +40,8 @@
 	$(MSGFMTCMD) -o $@ $<
 
 .po.ck:
-	$(VIMPROG) -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" -S check.vim \
-		-c "if error == 0 | q | else | num 2 | cq | endif" $<
+	$(VIMPROG) -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" \
+		-S check.vim -c "if error == 0 | q | else | num 2 | cq | endif" $<
 	touch $@
 
 check: $(CHECKFILES)
@@ -242,6 +241,7 @@
 clean: checkclean
 	rm -f core core.* *.old.po *.mo *.pot sjiscorr
 	rm -f LINGUAS vim.desktop gvim.desktop tmp_*desktop
+	rm -f ./allfiles
 #	rm -f big5corr
 
 distclean: clean
@@ -262,21 +262,25 @@
 
 $(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST)
 	# Convert the Vim scripts to (what looks like) Javascript.
-	$(VIMPROG) -u NONE --not-a-term -S $(PO_BASEDIR)/tojavascript.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
+	$(VIMPROG) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \
+		$(PO_VIM_INPUTLIST)
+	@ echo ${PO_INPUTLIST} | tr ' ' '\n' > ./allfiles
+	@ cat ./vim_to_js >> ./allfiles
 	# Create vim.pot.
-	$(XGETTEXT) --default-domain=$(PACKAGE) --add-comments \
-		$(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_VIM_JSLIST)
-	mv -f $(PACKAGE).po $(PACKAGE).pot
+	$(XGETTEXT) --default-domain=$(PACKAGE) --output=$(PACKAGE).pot \
+		--add-comments $(XGETTEXT_KEYWORDS) --files-from=./allfiles
 	# Fix Vim scripts names, so that "gf" works.
-	$(VIMPROG) -u NONE --not-a-term -S $(PO_BASEDIR)/fixfilenames.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
+	$(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \
+		$(PO_VIM_INPUTLIST)
 	# Delete the temporary files.
-	rm *.js
+	rm -f *.js ./vim_to_js
 
 vim.desktop: vim.desktop.in $(POFILES)
 	echo $(LANGUAGES) | tr " " "\n" |$(SED) -e '/\./d' | sort > LINGUAS
 	$(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop
 	rm -f LINGUAS
-	if command -v desktop-file-validate; then desktop-file-validate tmp_vim.desktop; fi
+	if command -v desktop-file-validate; \
+		then desktop-file-validate tmp_vim.desktop; fi
 	mv tmp_vim.desktop vim.desktop
 
 # The dependency on vim.desktop is only to avoid the two targets are build at
@@ -285,7 +289,8 @@
 	echo $(LANGUAGES) | tr " " "\n" |$(SED) -e '/\./d' | sort > LINGUAS
 	$(MSGFMT) --desktop -d . --template gvim.desktop.in -o tmp_gvim.desktop
 	rm -f LINGUAS
-	if command -v desktop-file-validate; then desktop-file-validate tmp_gvim.desktop; fi
+	if command -v desktop-file-validate; \
+		then desktop-file-validate tmp_gvim.desktop; fi
 	mv tmp_gvim.desktop gvim.desktop
 
 # Only original translations with default encoding should be updated.
@@ -302,3 +307,28 @@
 	else \
 	    echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
 	fi
+
+
+#######
+# For translations of plug-ins
+#######
+
+# Preparing the POT file of the plug-in package
+POT_PLUGPACKAGE_PATH != pwd
+$(PLUGPACKAGE).pot: $(PO_PLUG_INPUTLIST)
+	$(VIMPROG) -u NONE --not-a-term -S tojavascript.vim \
+		$(PLUGPACKAGE).pot $?
+	$(XGETTEXT) --from-code=UTF-8 --default-domain=$(PLUGPACKAGE) \
+		--package-name=$(PLUGPACKAGE) \
+		--output-dir=$(POT_PLUGPACKAGE_PATH) \
+		--output=$(PLUGPACKAGE).pot --files-from=./vim_to_js
+	$(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim \
+		$(POT_PLUGPACKAGE_PATH)/$(PLUGPACKAGE).pot $?
+	rm -f *.js ./vim_to_js
+
+# Converting the PO file of the plug-in package to the binary format of the MO
+MO_PLUGPACKAGE_PATH != pwd
+$(PLUGPACKAGE).mo: $(PO_PLUGPACKAGE)
+	$(MSGFMTCMD) -o $(MO_PLUGPACKAGE_PATH)/$@ $<
+
+# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make:
diff --git a/src/po/README.txt b/src/po/README.txt
index 50aff6a..801f5e5 100644
--- a/src/po/README.txt
+++ b/src/po/README.txt
@@ -160,3 +160,20 @@
 	"Content-Type: text/plain; charset=EUC-JP\n"
 
 There are examples in the Makefile for the conversions already supported.
+
+
+TRANSLATION OF VIM THE EDITOR PLUG-INS
+
+Vim supports displaying plugin messages for various native languages.
+Translation is available both for plugins that are supplied as part of the Vim
+editor (e.g. "optwin.vim") and for third-party plugin packages.
+
+To translate the plugins supplied with the Vim editor, you must specify a
+gettext() function call for the strings you want to translate.
+The translation of these strings will be retrieved by gettext() from the MO
+file "vim.mo".
+
+For third-party plugins, it is necessary to specify a one-time call to the
+bindtextdomain() function in scripts containing translation strings and for
+all message strings to add a {package} argument to the gettext() function. For
+more information, see ":help package-translation".
diff --git a/src/po/README_mvc.txt b/src/po/README_mvc.txt
index ae9fa2b..e5fd85e 100644
--- a/src/po/README_mvc.txt
+++ b/src/po/README_mvc.txt
@@ -137,4 +137,22 @@
 
 	nmake.exe -f Make_mvc.mak clean
 
+
+TRANSLATION OF VIM THE EDITOR PLUG-INS
+
+Vim supports displaying plugin messages for various native languages.
+Translation is available both for plugins that are supplied as part of the Vim
+editor (e.g. "optwin.vim") and for third-party plugin packages.
+
+To translate the plugins supplied with the Vim editor, you must specify a
+gettext() function call for the strings you want to translate.
+The translation of these strings will be retrieved by gettext() from the MO
+file "vim.mo".
+
+For third-party plugins, it is necessary to specify a one-time call to the
+bindtextdomain() function in scripts containing translation strings and for
+all message strings to add a {package} argument to the gettext() function. For
+more information, see ":help package-translation".
+
+
 vim:tw=78:
diff --git a/src/po/fixfilenames.vim b/src/po/fixfilenames.vim
index c92839e..2344b3b 100644
--- a/src/po/fixfilenames.vim
+++ b/src/po/fixfilenames.vim
@@ -3,9 +3,11 @@
 
 set shortmess+=A
 
-for name in argv()[1:]
-  let jsname = fnamemodify(name, ":r:gs?\\~?_?:gs?\\.?_?:gs?/?__?:gs?\\?__?") .. ".js"
-  exe "%s+" .. jsname .. "+" .. substitute(name, '\\', '/', 'g') .. "+"
+let s:namenum = 0
+for s:name in argv()[1:]
+  let s:jsname = fnamemodify(s:name, ":t:r") .. s:namenum .. ".js"
+  exe "%s+" .. s:jsname .. "+" .. substitute(s:name, '\\', '/', 'g') .. "+ge"
+  let s:namenum +=1
 endfor
 
 write
diff --git a/src/po/tojavascript.vim b/src/po/tojavascript.vim
index 32eea9b..4671a47 100644
--- a/src/po/tojavascript.vim
+++ b/src/po/tojavascript.vim
@@ -5,15 +5,20 @@
 
 set shortmess+=A
 
-for name in argv()[1:]
-  exe 'edit ' .. fnameescape(name)
+let s:namenum = 0
+let s:fls = []
+for s:name in argv()[1:]
+  exe 'edit ' .. fnameescape(s:name)
 
   " Strip comments, also after :set commands.
   g/^\s*"/s/.*//
   g/^\s*set .*"/s/.*//
 
   " Write as .js file, xgettext recognizes them
-  exe 'w! ' .. fnamemodify(name, ":r:gs?\\~?_?:gs?\\.?_?:gs?/?__?:gs?\\?__?") .. ".js"
+  let s:fl = fnamemodify(s:name, ":t:r") .. s:namenum .. ".js"
+  exe 'w! ' .. s:fl
+  call add(s:fls, s:fl)
+  let s:namenum += 1
 endfor
-
+call writefile(s:fls, "vim_to_js")
 quit
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index f199fec..76d4429 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -166,6 +166,7 @@
 	test_gettext \
 	test_gettext_cp1251 \
 	test_gettext_utf8 \
+	test_gettext_make \
 	test_getvar \
 	test_gf \
 	test_glob2regpat \
@@ -428,6 +429,7 @@
 	test_gettext.res \
 	test_gettext_cp1251.res \
 	test_gettext_utf8.res \
+	test_gettext_make.res \
 	test_getvar.res \
 	test_gf.res \
 	test_gn.res \
diff --git a/src/testdir/Make_mvc.mak b/src/testdir/Make_mvc.mak
index bd6d1a2..1bf9eae 100644
--- a/src/testdir/Make_mvc.mak
+++ b/src/testdir/Make_mvc.mak
@@ -42,7 +42,7 @@
 		else ( echo No failures reported > test_result.log )
 	$(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages
 	-if exist starttime del starttime
-	@echo.
+	@echo:
 	@echo Test results:
 	@cmd /c type test_result.log
 	@if exist test.log ( echo TEST FAILURE & exit /b 1 ) \
@@ -56,7 +56,7 @@
 	-if exist test.log del test.log
 	-if exist messages del messages
 	-if exist starttime del starttime
-	@$(MAKE) -nologo -f Make_mvc.mak $@.res VIMPROG=$(VIMPROG)
+	@$(MAKE) -nologo -f Make_mvc.mak VIMPROG=$(VIMPROG) $@.res
 	@type messages
 	@if exist test.log exit 1
 
diff --git a/src/testdir/test_gettext_cp1251.vim b/src/testdir/test_gettext_cp1251.vim
index c6f04bb..c91f784 100644
--- a/src/testdir/test_gettext_cp1251.vim
+++ b/src/testdir/test_gettext_cp1251.vim
@@ -1,20 +1,20 @@
 source check.vim
-" TODO: Why does this fail on MacOS 14 and Windows MSVC (Github CI)?
+" This fail on CI MacOS 14 because bindtextdomain() is not available there
+" (missing library?)
 CheckNotMac
-CheckNotMSWindows
 
 " Test for gettext()
 func Test_gettext()
   set encoding=cp1251
   call bindtextdomain("__PACKAGE__", getcwd())
   try
-    language ru_RU
+    language messages ru_RU
     call assert_equal('ÎØÈÁÊÀ: ', gettext("ERROR: ", "__PACKAGE__"))
   catch /^Vim\%((\a\+)\)\=:E197:/
     throw "Skipped: not possible to set locale to ru (missing?)"
   endtry
   try
-    language en_GB.UTF-8
+    language messages en_GB.UTF-8
     call assert_equal('ERROR: ', gettext("ERROR: ", "__PACKAGE__"))
   catch /^Vim\%((\a\+)\)\=:E197:/
     throw "Skipped: not possible to set locale to en (missing?)"
diff --git a/src/testdir/test_gettext_make.vim b/src/testdir/test_gettext_make.vim
new file mode 100644
index 0000000..480e2ee
--- /dev/null
+++ b/src/testdir/test_gettext_make.vim
@@ -0,0 +1,65 @@
+source check.vim
+"CheckNotMSWindows
+CheckNotMac
+
+" Test for package translation Makefile
+func Test_gettext_makefile()
+  cd ../po
+  if has('win32')
+    call system('nmake.exe -f Make_mvc.mak "VIMPROG=' .. getenv('VIMPROG') ..
+          \ '" "GETTEXT_PATH=' .. getenv('GETTEXT_PATH') ..
+          \ '" PLUGPACKAGE=test_gettext
+          \ "PO_PLUG_INPUTLIST=..\testdir\test_gettext_makefile_in1.vim
+          \ ..\testdir\test_gettext_makefile_in2.vim
+          \ ..\testdir\test_gettext_makefile_in3.vim
+          \ ..\testdir\test_gettext_makefile_in4.vim" test_gettext.pot')
+  else
+" Will it work on macOS?
+    call system("make -f Makefile PLUGPACKAGE=test_gettext
+          \ PO_PLUG_INPUTLIST=\"../testdir/test_gettext_makefile_in1.vim
+          \ ../testdir/test_gettext_makefile_in2.vim
+          \ ../testdir/test_gettext_makefile_in3.vim
+          \ ../testdir/test_gettext_makefile_in4.vim\" test_gettext.pot")
+  endif
+  let expected = [
+          \  '# SOME DESCRIPTIVE TITLE.',
+          \  '# Copyright (C) YEAR THE PACKAGE''S COPYRIGHT HOLDER',
+          \  '# This file is distributed under the same license as the test_gettext package.',
+          \  '# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.',
+          \  '#',
+          \  '#, fuzzy',
+          \  'msgid ""',
+          \  'msgstr ""',
+          \  '"Project-Id-Version: test_gettext\n"',
+          \  '"Report-Msgid-Bugs-To: \n"',
+          \  '"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"',
+          \  '"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"',
+          \  '"Language-Team: LANGUAGE <LL@li.org>\n"',
+          \  '"Language: \n"',
+          \  '"MIME-Version: 1.0\n"',
+          \  '"Content-Type: text/plain; charset=CHARSET\n"',
+          \  '"Content-Transfer-Encoding: 8bit\n"',
+          \  '',
+          \  '#: ../testdir/test_gettext_makefile_in1.vim:4 ../testdir/test_gettext_makefile_in1.vim:6',
+          \  '#: ../testdir/test_gettext_makefile_in2.vim:5 ../testdir/test_gettext_makefile_in4.vim:4',
+          \  'msgid "This is a test"',
+          \  'msgstr ""',
+          \  '',
+          \  '#: ../testdir/test_gettext_makefile_in1.vim:5',
+          \  'msgid "This is another test"',
+          \  'msgstr ""',
+          \  '',
+          \  '#: ../testdir/test_gettext_makefile_in2.vim:4',
+          \  'msgid "This is a test from the second file"',
+          \  'msgstr ""',
+          \  '',
+          \  '#: ../testdir/test_gettext_makefile_in4.vim:5',
+          \  'msgid "This is a fourth test"',
+          \  'msgstr ""']
+  let potfile = filter(readfile("test_gettext.pot"), 'v:val !~ "POT-Creation-Date"')
+  call assert_equal(expected, potfile)
+  call delete('test_gettext.pot')
+  cd -
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_gettext_makefile_in1.vim b/src/testdir/test_gettext_makefile_in1.vim
new file mode 100644
index 0000000..cbe1159
--- /dev/null
+++ b/src/testdir/test_gettext_makefile_in1.vim
@@ -0,0 +1,7 @@
+" Test file for gettext() package makefile
+" Last Change:	2024 Jun 01
+
+echo gettext("This is a test", "test_gettext")
+echo gettext("This is another test", "test_gettext")
+echo gettext("This is a test", "test_gettext")
+" vim: ts=8
diff --git a/src/testdir/test_gettext_makefile_in2.vim b/src/testdir/test_gettext_makefile_in2.vim
new file mode 100644
index 0000000..86d3dd9
--- /dev/null
+++ b/src/testdir/test_gettext_makefile_in2.vim
@@ -0,0 +1,6 @@
+" Test file for gettext() package makefile
+" Last Change:	2024 Jun 01
+
+echo gettext("This is a test from the second file", "test_gettext")
+echo gettext("This is a test", "test_gettext")
+" vim: ts=8
diff --git a/src/testdir/test_gettext_makefile_in3.vim b/src/testdir/test_gettext_makefile_in3.vim
new file mode 100644
index 0000000..f4cf93d
--- /dev/null
+++ b/src/testdir/test_gettext_makefile_in3.vim
@@ -0,0 +1,4 @@
+" Test file for gettext() package makefile
+" Last Change:	2024 Jun 01
+
+" vim: ts=8
diff --git a/src/testdir/test_gettext_makefile_in4.vim b/src/testdir/test_gettext_makefile_in4.vim
new file mode 100644
index 0000000..7f9f3f7
--- /dev/null
+++ b/src/testdir/test_gettext_makefile_in4.vim
@@ -0,0 +1,6 @@
+" Test file for gettext() package makefile
+" Last Change:	2024 Jun 01
+
+echo gettext("This is a test", "test_gettext")
+echo gettext("This is a fourth test", "test_gettext")
+" vim: ts=8
diff --git a/src/testdir/test_gettext_utf8.vim b/src/testdir/test_gettext_utf8.vim
index bb46ca0..7862e39 100644
--- a/src/testdir/test_gettext_utf8.vim
+++ b/src/testdir/test_gettext_utf8.vim
@@ -1,20 +1,20 @@
 source check.vim
-" TODO: Why does this fail on MacOS 14 and Windows MSVC (Github CI)?
+" This fail on CI MacOS 14 because bindtextdomain() is not available there
+" (missing library?)
 CheckNotMac
-CheckNotMSWindows
 
 " Test for gettext()
 func Test_gettext()
   set encoding=utf-8
   call bindtextdomain("__PACKAGE__", getcwd())
   try
-    language ru_RU
+    language messages ru_RU
     call assert_equal('ОШИБКА: ', gettext("ERROR: ", "__PACKAGE__"))
   catch /^Vim\%((\a\+)\)\=:E197:/
     throw "Skipped: not possible to set locale to ru (missing?)"
   endtry
   try
-    language en_GB.UTF-8
+    language messages en_GB.UTF-8
     call assert_equal('ERROR: ', gettext("ERROR: ", "__PACKAGE__"))
   catch /^Vim\%((\a\+)\)\=:E197:/
     throw "Skipped: not possible to set locale to en (missing?)"
diff --git a/src/version.c b/src/version.c
index aaef85f..cc2713a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    559,
+/**/
     558,
 /**/
     557,