mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
vim-patch:9.0.1586: error for using two messages with ngettext() differing in "%" (#23816)
Problem: Checking translations gives an error for using two messages with
ngettext() that differ in "%" items.
Solution: Adjust the check script to tolerate omitting one "%" item.
78ee62563e
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
b8a2220f5e
commit
2028d1e2bc
@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
if 1 " Only execute this if the eval feature is available.
|
if 1 " Only execute this if the eval feature is available.
|
||||||
|
|
||||||
|
" using line continuation
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
let filename = "check-" . expand("%:t:r") . ".log"
|
let filename = "check-" . expand("%:t:r") . ".log"
|
||||||
exe 'redir! > ' . filename
|
exe 'redir! > ' . filename
|
||||||
|
|
||||||
@ -62,12 +65,18 @@ while 1
|
|||||||
if getline(line('.') - 1) !~ "no-c-format"
|
if getline(line('.') - 1) !~ "no-c-format"
|
||||||
" go over the "msgid" and "msgid_plural" lines
|
" go over the "msgid" and "msgid_plural" lines
|
||||||
let prevfromline = 'foobar'
|
let prevfromline = 'foobar'
|
||||||
|
let plural = 0
|
||||||
while 1
|
while 1
|
||||||
|
if getline('.') =~ 'msgid_plural'
|
||||||
|
let plural += 1
|
||||||
|
endif
|
||||||
let fromline = GetMline()
|
let fromline = GetMline()
|
||||||
if prevfromline != 'foobar' && prevfromline != fromline
|
if prevfromline != 'foobar' && prevfromline != fromline
|
||||||
|
\ && (plural != 1
|
||||||
|
\ || count(prevfromline, '%') + 1 != count(fromline, '%'))
|
||||||
echomsg 'Mismatching % in line ' . (line('.') - 1)
|
echomsg 'Mismatching % in line ' . (line('.') - 1)
|
||||||
echomsg 'msgid: ' . prevfromline
|
echomsg 'msgid: ' . prevfromline
|
||||||
echomsg 'msgid ' . fromline
|
echomsg 'msgid: ' . fromline
|
||||||
if error == 0
|
if error == 0
|
||||||
let error = line('.')
|
let error = line('.')
|
||||||
endif
|
endif
|
||||||
@ -89,6 +98,7 @@ while 1
|
|||||||
while getline('.') =~ '^msgstr'
|
while getline('.') =~ '^msgstr'
|
||||||
let toline = GetMline()
|
let toline = GetMline()
|
||||||
if fromline != toline
|
if fromline != toline
|
||||||
|
\ && (plural == 0 || count(fromline, '%') != count(toline, '%') + 1)
|
||||||
echomsg 'Mismatching % in line ' . (line('.') - 1)
|
echomsg 'Mismatching % in line ' . (line('.') - 1)
|
||||||
echomsg 'msgid: ' . fromline
|
echomsg 'msgid: ' . fromline
|
||||||
echomsg 'msgstr: ' . toline
|
echomsg 'msgstr: ' . toline
|
||||||
|
Loading…
Reference in New Issue
Block a user