[vim/vim] gettext() for plugin translations (PR #15100)

61 views
Skip to first unread message

Restorer

unread,
Jun 24, 2024, 12:05:27 PM (9 days ago) Jun 24
to vim/vim, Subscribed

src/po/Makefile and src/po/Make_mvc.mak:
Created separate rules to handle plugins.

src/po/Make_all.mak:
The contents of the PO_VIM_JSLIST macro have been reverted to the initial state.

src/po/fixfilenames.vim and src/po/tojavascript.vim:
The fnamemodify function has been reverted to its original state.

src/po/README.txt and src/po/README_mvc.txt:
Added description on translating plugins.

doc/repeat.txt:
Changed description on preparing translations, added examples, added tags.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/15100

Commit Summary

File Changes

(10 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100@github.com>

Restorer

unread,
Jun 24, 2024, 12:12:10 PM (9 days ago) Jun 24
to vim/vim, Subscribed

@cvwillegen , you have done a great job, thank you very much!
I made some changes to the makefiles, hopefully it will make it a bit easier to
prepare translations for plugins. Please see if there is anything you need to
change. I tested the changes on Windows NT 6.1 and Ubuntu 22. There were no
errors, the files were created as expected.
Well, there are some more questions when preparing PO-files.
Could you please tell me how plurals will be handled? Is there such
functionality?
Is there a possibility to add comments for translators from source scripts to
PO-files?
Otherwise, as far as I have tested, everything works great.
Oh, and if you have time, please look at the following:
When processing the "netrw.vim" file, xgettex swears that it can't recognize
some lines.

@chrisbra , @cvwillegen , please look at the changes I made in the documentation.
When I wrote it in Russian, it was clear to me in principle.
But when translating into English, there may have been errors.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2186930601@github.com>

Restorer

unread,
Jun 24, 2024, 12:56:12 PM (8 days ago) Jun 24
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • 3149a5e removed trailing white space


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/20eb46109819d019a567abfdd2fc10974344dc04/after/3149a5ea106faf196fa205b9b38c3c5c546811a9@github.com>

Restorer

unread,
Jun 24, 2024, 1:28:53 PM (8 days ago) Jun 24
to vim/vim, Push

@RestorerZ pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/3149a5ea106faf196fa205b9b38c3c5c546811a9/after/9a7ef6f584c32673a595fba4a6f8739b640780db@github.com>

cvwillegen

unread,
Jun 26, 2024, 7:54:46 AM (7 days ago) Jun 26
to vim/vim, Subscribed

@cvwillegen commented on this pull request.


In runtime/doc/repeat.txt:

> +The author of the plugin or whoever would like to translate messages in the
+plugin must specify a call to the |bindtextdomain()| function somewhere at the
+beginning of the script, specifying the name of the package and the route to
+the directory where the file with the translated messages is located:
+>
+ :call bindtextdomain("foobar", fnamemodify(expand("<script>"), ':p:h') .. '/../lang/')
+<
+Where:
+"foobar" is the unique package identifier by which the |gettext()| function will
+later search for translation strings for this plugin.
+"lang/" is the relative or absolute path to the directory structure where the
+translation file is located.
+The directory structure where the message translation file is placed should be
+as follows: "lang/<lang_id>/LC_MESSAGES". To specify <lang_id>, i.e. the
+target language, see |multilang|.
+This function call is specified only once for the entire plug-in.

specified -> needed


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/review/2141570097@github.com>

cvwillegen

unread,
Jun 26, 2024, 8:03:17 AM (7 days ago) Jun 26
to vim/vim, Subscribed

@cvwillegen commented on this pull request.


In src/po/README.txt:

> @@ -160,3 +160,20 @@ convert ja.po to EUC-JP (supposed as your system encoding):
 	"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 once call to the

specify a once call -> specify a one-time call


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/review/2141587051@github.com>

cvwillegen

unread,
Jun 26, 2024, 8:04:11 AM (7 days ago) Jun 26
to vim/vim, Subscribed

@cvwillegen commented on this pull request.


In src/po/README.txt:

> +
+
+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 once call to the
+bindtextdomain() function in scripts containing translation strings, and for
+all message strings, the gettext() function. For more information, 

the gettext() function -> to add a {package} argument to the gettext() function


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/review/2141588989@github.com>

cvwillegen

unread,
Jun 26, 2024, 8:04:40 AM (7 days ago) Jun 26
to vim/vim, Subscribed

@cvwillegen commented on this pull request.


In src/po/README_mvc.txt:

> @@ -137,4 +137,22 @@ command:
 
 	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 once call to the

specify a once call -> specify a one-time call


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/review/2141589864@github.com>

cvwillegen

unread,
Jun 26, 2024, 8:04:48 AM (7 days ago) Jun 26
to vim/vim, Subscribed

@cvwillegen commented on this pull request.


In src/po/README_mvc.txt:

> @@ -137,4 +137,22 @@ command:
 
 	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 once call to the
+bindtextdomain() function in scripts containing translation strings, and for
+all message strings, the gettext() function. For more information, 

the gettext() function -> to add a {package} argument to the gettext() function


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/review/2141590298@github.com>

Restorer

unread,
Jun 26, 2024, 8:54:08 AM (7 days ago) Jun 26
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • 6de2107 fixed errors in the documentation

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/9a7ef6f584c32673a595fba4a6f8739b640780db/after/6de2107035421a949a054d9861eeb9fa5f2c18e9@github.com>

Restorer

unread,
Jun 26, 2024, 8:55:49 AM (7 days ago) Jun 26
to vim/vim, Subscribed

@RestorerZ commented on this pull request.


In runtime/doc/repeat.txt:

> +The author of the plugin or whoever would like to translate messages in the
+plugin must specify a call to the |bindtextdomain()| function somewhere at the
+beginning of the script, specifying the name of the package and the route to
+the directory where the file with the translated messages is located:
+>
+ :call bindtextdomain("foobar", fnamemodify(expand("<script>"), ':p:h') .. '/../lang/')
+<
+Where:
+"foobar" is the unique package identifier by which the |gettext()| function will
+later search for translation strings for this plugin.
+"lang/" is the relative or absolute path to the directory structure where the
+translation file is located.
+The directory structure where the message translation file is placed should be
+as follows: "lang/<lang_id>/LC_MESSAGES". To specify <lang_id>, i.e. the
+target language, see |multilang|.
+This function call is specified only once for the entire plug-in.

Thank you, I have corrected it.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/review/2141727487@github.com>

Restorer

unread,
Jun 26, 2024, 8:56:05 AM (7 days ago) Jun 26
to vim/vim, Subscribed

@RestorerZ commented on this pull request.


In src/po/README.txt:

> @@ -160,3 +160,20 @@ convert ja.po to EUC-JP (supposed as your system encoding):
 	"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 once call to the

Thank you, I have corrected it.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/review/2141728344@github.com>

Restorer

unread,
Jun 26, 2024, 8:56:23 AM (7 days ago) Jun 26
to vim/vim, Subscribed

@RestorerZ commented on this pull request.


In src/po/README.txt:

> +
+
+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 once call to the
+bindtextdomain() function in scripts containing translation strings, and for
+all message strings, the gettext() function. For more information, 

Thank you, I have corrected it.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/review/2141729471@github.com>

cvwillegen

unread,
Jun 26, 2024, 10:03:04 AM (7 days ago) Jun 26
to vim/vim, Subscribed

I made some changes to the makefiles, hopefully it
will make it a bit easier to prepare translations for plugins.

Yes and no...

The changes to PO_VIM_JSLIST, src/po/fixfilenames.vim and src/po/tojavascript.vim that I made are neccessary to make it possible for a plugin to have multiple .vim files with the same base name. The directory seperators are changed to __ to account for this. If you look at the original (Bram's) help, it said:

Your directory layout would be like this:
  ¦start/foobar/plugin/foo.vim          " always loaded, defines commands
  ¦start/foobar/plugin/bar.vim          " always loaded, defines commands
  ¦start/foobar/autoload/foo.vim        " loaded when foo command used

(note that there are 2 files called foo.vim)

This means, that both files called foo.vim are to be specified for the POT file creation. Because the temporary files are written one by one, the contents of the second file overwrite the first.

I've tested this:

~/.vim/bundle/Vundle.vim$ grep gettext */vundlelog.vim
ftplugin/vundlelog.vim:echo gettext("This is ftplugin/", "vundle")
syntax/vundlelog.vim:echo gettext("This is syntax/", "vundle")

(Run the Make command as indicated)

$ make -f Makefile "PLUGPACKAGE=vundle" "PO_PLUG_INPUTLIST=~/.vim/bundle/Vundle.vim/autoload/vundle.vim ~/.vim/bundle/Vundle.vim/autoload/vundle/config.vim ~/.vim/bundle/Vundle.vim/ftplugin/vundlelog.vim ~/.vim/bundle/Vundle.vim/syntax/vundlelog.vim" POT_PLUGPACKAGE_PATH=. VIMPROG=../vim vundle.pot

Result:

"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <L...@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: vundlelog.js:38
msgid "This is syntax/"
msgstr ""

As you can see, only one call to gettext() has been included.

Could you please tell me how plurals will be handled? Is there such functionality?

I think we need ngettext() and dngettext() for that. These are not (yet) implemented, but should not be hard to do. I'll look into that after we've done this part of the job :-)

Is there a possibility to add comments for translators from source scripts to PO-files?

I have no answer for this...

Oh, and if you have time, please look at the following: When processing the "netrw.vim"
file, xgettex swears that it can't recognize some lines.

I'll see what I can do, but I don't know if I'll succeed...

Please look into multiple .vim files having the same base name. I tried changing back the changes in the tojavascript.vim and fixfilenames.vim files, but that didn't work. I has to do with the $(?F:.vim=.js) in there, but I haven't been able to make it work yet...

Christ van Willegen


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2191791377@github.com>

Restorer

unread,
Jun 26, 2024, 10:40:58 AM (7 days ago) Jun 26
to vim/vim, Subscribed

This means, that both files called foo.vim are to be specified for the POT file creation. Because the temporary files are written one by one, the contents of the second file overwrite the first.

Oh, yes! I didn't take that into account. Thank you for paying attention to this.

Please look into multiple .vim files having the same base name. I tried changing back the changes in the tojavascript.vim and fixfilenames.vim files, but that didn't work. I has to do with the $(?F:.vim=.js) in there, but I haven't been able to make it work yet...

Yes, I will definitely try to fix it. But a little later.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2191882258@github.com>

Restorer

unread,
Jun 26, 2024, 10:44:18 AM (7 days ago) Jun 26
to vim/vim, Subscribed

@cvwillegen
Пока самый простой способ, который приходит на ум, чтобы это решить. Это создвать временные файлы ".js", там же где и исходные файлы ".vim".
То есть вместо $(?F:.vim=.js) использовать $(?:.vim=.js). Но в UNIX-подобных могут быть ограничения на запись в каталоги, наверное. Надо смотреть.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2191891106@github.com>

Restorer

unread,
Jun 26, 2024, 2:00:29 PM (6 days ago) Jun 26
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • 4b68ec7 Processing files with the same names

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/6de2107035421a949a054d9861eeb9fa5f2c18e9/after/4b68ec7cdf3c596380730415c40d886bf77d07c8@github.com>

Restorer

unread,
Jun 26, 2024, 2:03:18 PM (6 days ago) Jun 26
to vim/vim, Subscribed

@cvwillegen
Kindly test out this alternative.
I quickly made a rough drawing of it.
I have only tested it on WinNT 6.1 up to now.
It appears to be functioning properly.

nmake.exe -f Make_mvc.mak "VIMPROG=D:\Programs\Vim\vim91\vim.exe" "PLUGPACKAGE=make" "PO_PLUG_INPUTLIST=..\..\runtime\syntax\make.vim ..\..\runtime\ftplugin\make.vim ..\..\runtime\indent\make.vim" make.pot
msgid ""
msgstr ""
"Project-Id-Version: make\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-26 20:45+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <L...@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: make0.js:16
msgid "This is make.vim in syntax"
msgstr ""

#: make1.js:15
msgid "This is make.vim in ftplugin"
msgstr ""

#: make2.js:18
msgid "This is make.vim in indent"
msgstr ""


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2192318617@github.com>

Restorer

unread,
Jun 26, 2024, 6:16:36 PM (6 days ago) Jun 26
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • 9aeccfd Correcting path recognition

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/4b68ec7cdf3c596380730415c40d886bf77d07c8/after/9aeccfd3d89030a62d1303597798431e4ac4fb8a@github.com>

Restorer

unread,
Jun 26, 2024, 6:21:04 PM (6 days ago) Jun 26
to vim/vim, Subscribed

Everything seems to be working correctly now. The path is recognized in the Vim script when adjusted. A template PO for the Vim editor is also normally created. I checked it in Windows and Ubuntu.

nmake.exe -f Make_mvc.mak "VIMPROG=D:\Programs\Vim\vim91\vim.exe" "PLUGPACKAGE=make" "PO_PLUG_INPUTLIST=d:\programs\vim\vim91\syntax\make.vim d:\programs\vim\vim91\ftplugin\make.vim d:\programs\vim\vim91\indent\make.vim" make.pot
Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: d:/Programs/Vim/vim91/syntax/make.vim:16
msgid "This is make.vim in syntax"
msgstr ""

#: d:/Programs/Vim/vim91/ftplugin/make.vim:13
msgid "This is make.vim in ftplugin"
msgstr ""

#: d:/Programs/Vim/vim91/indent/make.vim:18
msgid "This is make.vim in indent"
msgstr ""
make -f Makefile "VIMPROG=vim" "PLUGPACKAGE=make" "PO_PLUG_INPUTLIST=../../runtime/ftplugin/make.vim ../../runtime/indent/make.vim ../../runtime/syntax/make.vim" make.pot
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../../runtime/ftplugin/make.vim:13
msgid "This is make.vim in ftplugin"
msgstr ""

#: ../../runtime/indent/make.vim:12
msgid "This is make.vim in indent"
msgstr ""

#: ../../runtime/syntax/make.vim:13
msgid "This is make.vim in syntax"
msgstr ""


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2192715909@github.com>

Restorer

unread,
Jun 27, 2024, 3:39:14 AM (6 days ago) Jun 27
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • b9b1622 refactoring fixflenames and tojavascript

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/9aeccfd3d89030a62d1303597798431e4ac4fb8a/after/b9b1622d86368f0ca54b9e4fca85da62e1976973@github.com>

cvwillegen

unread,
Jun 28, 2024, 7:35:47 AM (5 days ago) Jun 28
to vim/vim, Subscribed

It's weird, when I run your make.pot example (I added a few gettext() calls in the right place), my make.pot file looks correct, but my vundle.pot end with these lines:

"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: vundlelog2.js:17
msgid "This is ftplugin/"
msgstr ""

#: vundlelog3.js:38
msgid "This is syntax/"
msgstr ""

I found the problem, and it may have been in there for a long time...

You added gettext() calls to all files called make.vim in your runtime/*/ files, and added them all to the invocation of the Makefile.

Let me change your example to this:

~/src/vim_restorer/src/po$ make -f Makefile "VIMPROG=vim" "PLUGPACKAGE=make" "PO_PLUG_INPUTLIST=~/src/vim_restorer/runtime/ftplugin/make.vim ../../runtime/syntax/xcompose.vim ../../runtime/indent/make.vim ../../runtime/syntax/make.vim" make.pot

(I added a non-sensical xcompose.vim to the input file list. I could imagine you would 'just' put a find -R in there to get all files in your plugin, or you'd have to remember which files has gettext() calls and which ones didn't...)

In that case, the make.pot looks like:

"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: /home/christ/src/vim_restorer/runtime/ftplugin/make.vim:13
msgid "This is make.vim in ftplugin"
msgstr ""

#: make2.js:18
msgid "This is make.vim in indent"
msgstr ""

#: make3.js:16
msgid "This is make.vim in syntax"
msgstr ""

This means that the search/replace will fail after not finding a file. As I said before, this has probably been in there for a long time...

This patch fixes it:

diff --git a/src/po/fixfilenames.vim b/src/po/fixfilenames.vim
index c698c4885..0a8780ea4 100644
--- a/src/po/fixfilenames.vim
+++ b/src/po/fixfilenames.vim
@@ -6,7 +6,7 @@ set shortmess+=A
 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') .. "+"
+  exe "%s+" .. s:jsname .. "+" .. substitute(s:name, '\\', '/', 'g') .. "+e"
   let s:namenum +=1
 endfor

Whew, glad we're testing this!

Christ van Willegen


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2196700109@github.com>

Restorer

unread,
Jun 28, 2024, 10:10:47 AM (5 days ago) Jun 28
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • ae2c123 continued processing in fixfilename.vim in case of an error

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/b9b1622d86368f0ca54b9e4fca85da62e1976973/after/ae2c1231390aa2be7be96458d92ba42f442ceda9@github.com>

Restorer

unread,
Jun 28, 2024, 10:18:42 AM (5 days ago) Jun 28
to vim/vim, Subscribed

Yes, everything is functioning properly. Thank you!

nmake.exe -f Make_mvc.mak "VIMPROG=vim.exe" "PLUGPACKAGE=make" "PO_PLUG_INPUTLIST=..\..\runtime\ftplugin\make.vim ..\..\runtime\syntax\xcompose.vim ..\..\runtime\indent\make.vim ..\..\runtime\syntax\make.vim" make.pot
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../../runtime/ftplugin/make.vim:12
msgid "This is make.vim in ftplugin"
msgstr ""

#: ../../runtime/indent/make.vim:11
msgid "This is make.vim in indent"
msgstr ""

#: ../../runtime/syntax/make.vim:15
msgid "This is make.vim in syntax"
msgstr ""


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2197044446@github.com>

Restorer

unread,
Jun 28, 2024, 2:35:32 PM (4 days ago) Jun 28
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • 7b49bdc processing multiple file names

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/ae2c1231390aa2be7be96458d92ba42f442ceda9/after/7b49bdc60dbe795998544b0fd49af683bfa86928@github.com>

Restorer

unread,
Jun 28, 2024, 2:37:12 PM (4 days ago) Jun 28
to vim/vim, Subscribed

Processing of several file names. For example:

#: ../../runtime/autoload/netrw.vim:4852 ../../runtime/autoload/netrw.vim:9986
msgid "\"   Quick Help: <F1>:help  "
msgstr ""


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2197442678@github.com>

cvwillegen

unread,
Jun 30, 2024, 8:28:22 AM (3 days ago) Jun 30
to vim/vim, Subscribed

Ok, I've checked it out some more, and it looks ok so far..

I would suggest adding a test for the Makefile, like this:

$ git status -v
On branch gettext-for-plugin
Your branch is up to date with 'origin/gettext-for-plugin'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   src/testdir/Make_all.mak
	new file:   src/testdir/test_gettext_make.vim
	new file:   src/testdir/test_gettext_makefile_in1.vim
	new file:   src/testdir/test_gettext_makefile_in2.vim
	new file:   src/testdir/test_gettext_makefile_in3.vim
	new file:   src/testdir/test_gettext_makefile_in4.vim

diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index a49f15875..1f22cdf04 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -164,6 +164,7 @@ NEW_TESTS = \
 	test_gettext \
 	test_gettext_cp1251 \
 	test_gettext_utf8 \
+	test_gettext_make \
 	test_getvar \
 	test_gf \
 	test_glob2regpat \
diff --git a/src/testdir/test_gettext_make.vim b/src/testdir/test_gettext_make.vim
new file mode 100644
index 000000000..8f3466a71
--- /dev/null
+++ b/src/testdir/test_gettext_make.vim
@@ -0,0 +1,49 @@
+source check.vim
+CheckNotMSWindows
+
+" Test for package translation Makefile
+func Test_gettext_makefile_notwindows()
+  cd ../po
+  let make=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")
+  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 <L...@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 000000000..cbe11591f
--- /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 000000000..86d3dd9ed
--- /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 000000000..f4cf93d1a
--- /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 000000000..7f9f3f7dd
--- /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

This adds a test target that runs the Makefile. It includes a few (mostly empty...) .vim files that have calls to gettext() in them to test that the .POT file is created successfully.

I don't have a Windows machine, so perhaps you can add a test function for testing this on Windows??

Thank you for looking into how to make it easier to create a .POT file for a plugin! That was my greatest nightmare (and we all have our strengths and parts where others can help...)

Christ van Willegen


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2198546143@github.com>

Restorer

unread,
Jun 30, 2024, 4:49:27 PM (2 days ago) Jun 30
to vim/vim, Subscribed

@cvwillegen
Yes, I agree, tests are useful and should be done. I'll look into it all, but please give me some time.

I'll try to add a test for MS Windows (to be honest, I haven't worked with test files for Vim yet).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/c2198753190@github.com>

Restorer

unread,
Jul 1, 2024, 11:49:35 AM (2 days ago) Jul 1
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • 8d573be tests for gettext() in plugins

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/7b49bdc60dbe795998544b0fd49af683bfa86928/after/8d573be7577b8664db95550f9d14e188daf7a5ee@github.com>

Restorer

unread,
Jul 1, 2024, 3:04:58 PM (2 days ago) Jul 1
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • fbc9e4c disabled make test for MS Windows added libintl-8.dll

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/8d573be7577b8664db95550f9d14e188daf7a5ee/after/fbc9e4cda36c882033ce190f248b75ccea1d6730@github.com>

Restorer

unread,
Jul 1, 2024, 3:18:46 PM (2 days ago) Jul 1
to vim/vim, Push

@RestorerZ pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/fbc9e4cda36c882033ce190f248b75ccea1d6730/after/24c18fe7315bde9ed828b756c36923548b9ab1f5@github.com>

Restorer

unread,
Jul 1, 2024, 3:24:53 PM (2 days ago) Jul 1
to vim/vim, Push

@RestorerZ pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/24c18fe7315bde9ed828b756c36923548b9ab1f5/after/7120d38812cd61ea02da5f42950968d6ed4ef412@github.com>

Restorer

unread,
Jul 1, 2024, 3:33:55 PM (2 days ago) Jul 1
to vim/vim, Push

@RestorerZ pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/7120d38812cd61ea02da5f42950968d6ed4ef412/after/aba749ae56259688b037451311ea49de03999368@github.com>

Restorer

unread,
Jul 1, 2024, 4:34:19 PM (2 days ago) Jul 1
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • a726549 fix4 ci.yml disabled make test for macOS

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/aba749ae56259688b037451311ea49de03999368/after/a7265496664e2a1fa1cb8d6b50fcba3e5952f108@github.com>

Restorer

unread,
Jul 1, 2024, 5:48:34 PM (2 days ago) Jul 1
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • 7190a96 copy libiconv enable make test for MS Windows

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/a7265496664e2a1fa1cb8d6b50fcba3e5952f108/after/7190a96e4616957f2397b7ceab727d636b3d635e@github.com>

Restorer

unread,
Jul 1, 2024, 6:59:42 PM (2 days ago) Jul 1
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • 005cd81 disable make test for MS Windows

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/7190a96e4616957f2397b7ceab727d636b3d635e/after/005cd8101184875ecb4f497f41f4124fdfa9bdfa@github.com>

Restorer

unread,
Jul 2, 2024, 2:12:14 AM (22 hours ago) Jul 2
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • 937e97c we are trying to run the tests again

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/005cd8101184875ecb4f497f41f4124fdfa9bdfa/after/937e97c2c8d3cd8e55df302f607b0ae249644e46@github.com>

Restorer

unread,
Jul 2, 2024, 6:58:16 AM (17 hours ago) Jul 2
to vim/vim, Push

@RestorerZ pushed 1 commit.

  • a81336a testing for the test_gettext_make test

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/937e97c2c8d3cd8e55df302f607b0ae249644e46/after/a81336a462a4cf1f88c3c9c66cc9ea8c14aaa2f0@github.com>

Restorer

unread,
Jul 2, 2024, 8:01:40 AM (16 hours ago) Jul 2
to vim/vim, Push

@RestorerZ pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/a81336a462a4cf1f88c3c9c66cc9ea8c14aaa2f0/after/a90698b32d63254ff1bd73f685b4d2bee5b16cf2@github.com>

Restorer

unread,
Jul 2, 2024, 10:21:20 AM (14 hours ago) Jul 2
to vim/vim, Push

@RestorerZ pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/a90698b32d63254ff1bd73f685b4d2bee5b16cf2/after/35c787a7e16ff09b6e7d2adfcef55ea4b15300f1@github.com>

Restorer

unread,
Jul 2, 2024, 11:36:31 AM (13 hours ago) Jul 2
to vim/vim, Push

@RestorerZ pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/35c787a7e16ff09b6e7d2adfcef55ea4b15300f1/after/5f74b5f3c8abebf9bd55e67ac6390097bcc356e6@github.com>

Restorer

unread,
Jul 2, 2024, 12:01:11 PM (12 hours ago) Jul 2
to vim/vim, Push

@RestorerZ pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/5f74b5f3c8abebf9bd55e67ac6390097bcc356e6/after/71af6b510db339a22f49517ac0ac8632e60c5893@github.com>

Restorer

unread,
Jul 2, 2024, 12:38:25 PM (12 hours ago) Jul 2
to vim/vim, Push

@RestorerZ pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15100/before/71af6b510db339a22f49517ac0ac8632e60c5893/after/fd9e2baa75c17607a4787dec8654e8b66c4333a8@github.com>

Reply all
Reply to author
Forward
0 new messages