To: vim_dev@googlegroups.com Subject: Patch 9.0.1586 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1586 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. Files: src/po/check.vim *** ../vim-9.0.1585/src/po/check.vim 2022-05-22 15:26:08.000000000 +0100 --- src/po/check.vim 2023-05-28 18:33:11.488991433 +0100 *************** *** 6,11 **** --- 6,14 ---- if 1 " Only execute this if the eval feature is available. + " using line continuation + set cpo&vim + " Function to get a split line at the cursor. " Used for both msgid and msgstr lines. " Removes all text except % items and returns the result. *************** *** 59,70 **** if getline(line('.') - 1) !~ "no-c-format" " go over the "msgid" and "msgid_plural" lines let prevfromline = 'foobar' while 1 let fromline = GetMline() if prevfromline != 'foobar' && prevfromline != fromline echomsg 'Mismatching % in line ' . (line('.') - 1) echomsg 'msgid: ' . prevfromline ! echomsg 'msgid ' . fromline if error == 0 let error = line('.') endif --- 62,79 ---- if getline(line('.') - 1) !~ "no-c-format" " go over the "msgid" and "msgid_plural" lines let prevfromline = 'foobar' + let plural = 0 while 1 + if getline('.') =~ 'msgid_plural' + let plural += 1 + endif let fromline = GetMline() if prevfromline != 'foobar' && prevfromline != fromline + \ && (plural != 1 + \ || count(prevfromline, '%') + 1 != count(fromline, '%')) echomsg 'Mismatching % in line ' . (line('.') - 1) echomsg 'msgid: ' . prevfromline ! echomsg 'msgid: ' . fromline if error == 0 let error = line('.') endif *************** *** 86,91 **** --- 95,101 ---- while getline('.') =~ '^msgstr' let toline = GetMline() if fromline != toline + \ && (plural == 0 || count(fromline, '%') != count(toline, '%') + 1) echomsg 'Mismatching % in line ' . (line('.') - 1) echomsg 'msgid: ' . fromline echomsg 'msgstr: ' . toline *** ../vim-9.0.1585/src/version.c 2023-05-27 22:22:06.458633197 +0100 --- src/version.c 2023-05-28 18:21:57.190029418 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1586, /**/ -- How many light bulbs does it take to change a person? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///