0
0
mirror of https://github.com/vim/vim.git synced 2025-10-05 05:34:07 -04:00

patch 8.0.1839: script to check .po file doesn't check for plural header

Problem:    Script to check .po file doesn't check for plural header.
Solution:   Add a check that the plural header is present when needed.
This commit is contained in:
Bram Moolenaar
2018-05-13 22:37:03 +02:00
parent eb3dc87f01
commit 9cfc7d885c
2 changed files with 19 additions and 0 deletions

View File

@@ -157,6 +157,23 @@ if executable("msgfmt")
endif endif
endif endif
" Check that the plural form is properly initialized
1
let plural = search('^msgid_plural ', 'n')
if (plural && search('^"Plural-Forms: ', 'n') == 0) || (plural && search('^msgstr\[0\] ".\+"', 'n') != plural + 1)
if search('^"Plural-Forms: ', 'n') == 0
echomsg "Missing Plural header"
if error == 0
let error = search('\(^"[A-Za-z-_]\+: .*\\n"\n\)\+\zs', 'n') - 1
endif
elseif error == 0
let error = plural
endif
elseif !plural && search('^"Plural-Forms: ', 'n')
" We allow for a stray plural header, msginit adds one.
endif
if error == 0 if error == 0
" If all was OK restore the view. " If all was OK restore the view.
call winrestview(wsv) call winrestview(wsv)

View File

@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1839,
/**/ /**/
1838, 1838,
/**/ /**/