diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-05-13 22:37:03 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-05-13 22:37:03 +0200 |
commit | 9cfc7d885cb3bf37362b11df19a38992893fb385 (patch) | |
tree | 7ee616a837a7da36bb141223205ccc6602970417 /src/po | |
parent | eb3dc87f01391bb075d97aef3d00f91b4e08a25c (diff) | |
download | vim-git-9cfc7d885cb3bf37362b11df19a38992893fb385.tar.gz |
patch 8.0.1839: script to check .po file doesn't check for plural headerv8.0.1839
Problem: Script to check .po file doesn't check for plural header.
Solution: Add a check that the plural header is present when needed.
Diffstat (limited to 'src/po')
-rw-r--r-- | src/po/check.vim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/po/check.vim b/src/po/check.vim index 9cfa36a7c..24c4d79cb 100644 --- a/src/po/check.vim +++ b/src/po/check.vim @@ -157,6 +157,23 @@ if executable("msgfmt") 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 all was OK restore the view. call winrestview(wsv) |