aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/po
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-28 11:25:29 +0800
committerGitHub <noreply@github.com>2022-10-28 11:25:29 +0800
commit685ff3ee7247c5118fd8ef1c229af60066a4fcb4 (patch)
tree231d1be8bd319797096033e5197ef9d04da848c2 /src/nvim/po
parentf44ad753801d881f5352c9182167ced18e79e456 (diff)
parentbbbcd5393dc1ad02effc87d55665412ffaa19cc8 (diff)
downloadrneovim-685ff3ee7247c5118fd8ef1c229af60066a4fcb4.tar.gz
rneovim-685ff3ee7247c5118fd8ef1c229af60066a4fcb4.tar.bz2
rneovim-685ff3ee7247c5118fd8ef1c229af60066a4fcb4.zip
Merge pull request #20832 from zeertzjq/vim-8.2.1544
vim-patch:8.2.{1544,1585}: cannot translate messages in a Vim script
Diffstat (limited to 'src/nvim/po')
-rw-r--r--src/nvim/po/fixfilenames.vim13
-rw-r--r--src/nvim/po/tojavascript.vim18
2 files changed, 31 insertions, 0 deletions
diff --git a/src/nvim/po/fixfilenames.vim b/src/nvim/po/fixfilenames.vim
new file mode 100644
index 0000000000..04bc0791c0
--- /dev/null
+++ b/src/nvim/po/fixfilenames.vim
@@ -0,0 +1,13 @@
+" Invoked with the name "vim.pot" and a list of Vim script names.
+" Converts them to a .js file, stripping comments, so that xgettext works.
+
+set shortmess+=A
+
+for name in argv()[1:]
+ let jsname = fnamemodify(name, ":t:r") .. ".js"
+ exe "%s+" .. jsname .. "+" .. substitute(name, '\\', '/', 'g') .. "+"
+endfor
+
+write
+last
+quit
diff --git a/src/nvim/po/tojavascript.vim b/src/nvim/po/tojavascript.vim
new file mode 100644
index 0000000000..7868570be7
--- /dev/null
+++ b/src/nvim/po/tojavascript.vim
@@ -0,0 +1,18 @@
+" Invoked with the name "vim.pot" and a list of Vim script names.
+" Converts them to a .js file, stripping comments, so that xgettext works.
+" Javascript is used because, like Vim, it accepts both single and double
+" quoted strings.
+
+set shortmess+=A
+
+for name in argv()[1:]
+ exe 'edit ' .. fnameescape(name)
+
+ " Strip comments
+ g/^\s*"/s/.*//
+
+ " Write as .js file, xgettext recognizes them
+ exe 'w! ' .. fnamemodify(name, ":t:r") .. ".js"
+endfor
+
+quit