comparison src/po/check.vim @ 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 9d6cd12ae7bc
children b79453d0d01c
comparison
equal deleted inserted replaced
13937:cd513458728c 13938:b9db0bc9b8f9
155 let error = matchstr(a, filename.':\zs\d\+\ze:')+0 155 let error = matchstr(a, filename.':\zs\d\+\ze:')+0
156 for line in split(a, '\n') | echomsg line | endfor 156 for line in split(a, '\n') | echomsg line | endfor
157 endif 157 endif
158 endif 158 endif
159 159
160 " Check that the plural form is properly initialized
161 1
162 let plural = search('^msgid_plural ', 'n')
163 if (plural && search('^"Plural-Forms: ', 'n') == 0) || (plural && search('^msgstr\[0\] ".\+"', 'n') != plural + 1)
164 if search('^"Plural-Forms: ', 'n') == 0
165 echomsg "Missing Plural header"
166 if error == 0
167 let error = search('\(^"[A-Za-z-_]\+: .*\\n"\n\)\+\zs', 'n') - 1
168 endif
169 elseif error == 0
170 let error = plural
171 endif
172 elseif !plural && search('^"Plural-Forms: ', 'n')
173 " We allow for a stray plural header, msginit adds one.
174 endif
175
176
160 if error == 0 177 if error == 0
161 " If all was OK restore the view. 178 " If all was OK restore the view.
162 call winrestview(wsv) 179 call winrestview(wsv)
163 echomsg "OK" 180 echomsg "OK"
164 else 181 else