blob: 4671a472fa10b18a6e60e9a18c533432e615a0b2 [file] [log] [blame]
Bram Moolenaar0b39c3f2020-08-30 15:52:10 +02001" Invoked with the name "vim.pot" and a list of Vim script names.
2" Converts them to a .js file, stripping comments, so that xgettext works.
3" Javascript is used because, like Vim, it accepts both single and double
4" quoted strings.
5
6set shortmess+=A
7
RestorerZ96509102024-07-11 21:14:15 +02008let s:namenum = 0
9let s:fls = []
10for s:name in argv()[1:]
11 exe 'edit ' .. fnameescape(s:name)
Bram Moolenaar0b39c3f2020-08-30 15:52:10 +020012
Bram Moolenaar65b34862023-05-10 14:47:50 +010013 " Strip comments, also after :set commands.
Bram Moolenaar0b39c3f2020-08-30 15:52:10 +020014 g/^\s*"/s/.*//
Bram Moolenaar65b34862023-05-10 14:47:50 +010015 g/^\s*set .*"/s/.*//
Bram Moolenaar0b39c3f2020-08-30 15:52:10 +020016
17 " Write as .js file, xgettext recognizes them
RestorerZ96509102024-07-11 21:14:15 +020018 let s:fl = fnamemodify(s:name, ":t:r") .. s:namenum .. ".js"
19 exe 'w! ' .. s:fl
20 call add(s:fls, s:fl)
21 let s:namenum += 1
Bram Moolenaar0b39c3f2020-08-30 15:52:10 +020022endfor
RestorerZ96509102024-07-11 21:14:15 +020023call writefile(s:fls, "vim_to_js")
Bram Moolenaar0b39c3f2020-08-30 15:52:10 +020024quit