To: vim_dev@googlegroups.com Subject: Patch 7.4.2255 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2255 Problem: The script that checks translations can't handle plurals. Solution: Check for plural msgid and msgstr entries. Leave the cursor on the first error. Files: src/po/check.vim *** ../vim-7.4.2254/src/po/check.vim 2010-08-04 15:45:12.000000000 +0200 --- src/po/check.vim 2016-08-26 15:45:00.736129856 +0200 *************** *** 30,65 **** return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g') endfunc ! " This only works when 'wrapscan' is set. let s:save_wrapscan = &wrapscan ! set wrapscan " Start at the first "msgid" line. 1 ! /^msgid ! let startline = line('.') let error = 0 while 1 if getline(line('.') - 1) !~ "no-c-format" ! let fromline = GetMline() if getline('.') !~ '^msgstr' ! echo 'Missing "msgstr" in line ' . line('.') ! let error = 1 ! endif ! let toline = GetMline() ! if fromline != toline ! echo 'Mismatching % in line ' . (line('.') - 1) ! echo 'msgid: ' . fromline ! echo 'msgstr: ' . toline ! let error = 1 endif endif ! " Find next msgid. ! " Wrap around at the end of the file, quit when back at the first one. ! /^msgid ! if line('.') == startline break endif endwhile --- 30,95 ---- return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g') endfunc ! " This only works when 'wrapscan' is not set. let s:save_wrapscan = &wrapscan ! set nowrapscan " Start at the first "msgid" line. 1 ! /^msgid\> ! ! " When an error is detected this is set to the line number. ! " Note: this is used in the Makefile. let error = 0 while 1 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 ! endif ! if getline('.') !~ 'msgid_plural' ! break ! endif ! let prevfromline = fromline ! endwhile ! if getline('.') !~ '^msgstr' ! echomsg 'Missing "msgstr" in line ' . line('.') ! if error == 0 ! let error = line('.') ! endif endif + + " check all the 'msgstr' lines + while getline('.') =~ '^msgstr' + let toline = GetMline() + if fromline != toline + echomsg 'Mismatching % in line ' . (line('.') - 1) + echomsg 'msgid: ' . fromline + echomsg 'msgstr: ' . toline + if error == 0 + let error = line('.') + endif + endif + if line('.') == line('$') + break + endif + endwhile endif ! " Find next msgid. Quit when there is no more. ! let lnum = line('.') ! silent! /^msgid\> ! if line('.') == lnum break endif endwhile *************** *** 74,85 **** " 1 if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0 ! echo 'Mismatching error/warning code in line ' . line('.') ! let error = 1 endif if error == 0 ! echo "OK" endif let &wrapscan = s:save_wrapscan --- 104,119 ---- " 1 if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0 ! echomsg 'Mismatching error/warning code in line ' . line('.') ! if error == 0 ! let error = line('.') ! endif endif if error == 0 ! echomsg "OK" ! else ! exe error endif let &wrapscan = s:save_wrapscan *** ../vim-7.4.2254/src/version.c 2016-08-26 12:54:49.087190201 +0200 --- src/version.c 2016-08-26 14:42:22.472463763 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2255, /**/ -- If your nose runs, and your feet smell, you might be upside down. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///