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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230528174020.5655D1C0B0E%40moolenaar.net.