Mercurial > vim
changeset 13938:b9db0bc9b8f9 v8.0.1839
patch 8.0.1839: script to check .po file doesn't check for plural header
commit https://github.com/vim/vim/commit/9cfc7d885cb3bf37362b11df19a38992893fb385
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 13 22:37:03 2018 +0200
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 13 May 2018 22:45:07 +0200 |
parents | cd513458728c |
children | 080415f4b956 |
files | src/po/check.vim src/version.c |
diffstat | 2 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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)