6
6
7
7
if 1 " Only execute this if the eval feature is available.
8
8
9
+ " using line continuation
10
+ set cpo &vim
11
+
9
12
" Function to get a split line at the cursor.
10
13
" Used for both msgid and msgstr lines.
11
14
" Removes all text except % items and returns the result.
@@ -59,12 +62,18 @@ while 1
59
62
if getline (line (' .' ) - 1 ) !~ " no-c-format"
60
63
" go over the "msgid" and "msgid_plural" lines
61
64
let prevfromline = ' foobar'
65
+ let plural = 0
62
66
while 1
67
+ if getline (' .' ) = ~ ' msgid_plural'
68
+ let plural += 1
69
+ endif
63
70
let fromline = GetMline ()
64
71
if prevfromline != ' foobar' && prevfromline != fromline
72
+ \ && (plural != 1
73
+ \ || count (prevfromline, ' %' ) + 1 != count (fromline, ' %' ))
65
74
echomsg ' Mismatching % in line ' . (line (' .' ) - 1 )
66
75
echomsg ' msgid: ' . prevfromline
67
- echomsg ' msgid ' . fromline
76
+ echomsg ' msgid: ' . fromline
68
77
if error == 0
69
78
let error = line (' .' )
70
79
endif
@@ -86,6 +95,7 @@ while 1
86
95
while getline (' .' ) = ~ ' ^msgstr'
87
96
let toline = GetMline ()
88
97
if fromline != toline
98
+ \ && (plural == 0 || count (fromline, ' %' ) != count (toline, ' %' ) + 1 )
89
99
echomsg ' Mismatching % in line ' . (line (' .' ) - 1 )
90
100
echomsg ' msgid: ' . fromline
91
101
echomsg ' msgstr: ' . toline
0 commit comments