66
77if 1 " Only execute this if the eval feature is available.
88
9+ " using line continuation
10+ set cpo &vim
11+
912" Function to get a split line at the cursor.
1013" Used for both msgid and msgstr lines.
1114" Removes all text except % items and returns the result.
@@ -59,12 +62,18 @@ while 1
5962 if getline (line (' .' ) - 1 ) !~ " no-c-format"
6063 " go over the "msgid" and "msgid_plural" lines
6164 let prevfromline = ' foobar'
65+ let plural = 0
6266 while 1
67+ if getline (' .' ) = ~ ' msgid_plural'
68+ let plural += 1
69+ endif
6370 let fromline = GetMline ()
6471 if prevfromline != ' foobar' && prevfromline != fromline
72+ \ && (plural != 1
73+ \ || count (prevfromline, ' %' ) + 1 != count (fromline, ' %' ))
6574 echomsg ' Mismatching % in line ' . (line (' .' ) - 1 )
6675 echomsg ' msgid: ' . prevfromline
67- echomsg ' msgid ' . fromline
76+ echomsg ' msgid: ' . fromline
6877 if error == 0
6978 let error = line (' .' )
7079 endif
@@ -86,6 +95,7 @@ while 1
8695 while getline (' .' ) = ~ ' ^msgstr'
8796 let toline = GetMline ()
8897 if fromline != toline
98+ \ && (plural == 0 || count (fromline, ' %' ) != count (toline, ' %' ) + 1 )
8999 echomsg ' Mismatching % in line ' . (line (' .' ) - 1 )
90100 echomsg ' msgid: ' . fromline
91101 echomsg ' msgstr: ' . toline
0 commit comments