Skip to content

Commit 9cfc7d8

Browse files
committed
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.
1 parent eb3dc87 commit 9cfc7d8

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/po/check.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,23 @@ if executable("msgfmt")
157157
endif
158158
endif
159159

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+
160177
if error == 0
161178
" If all was OK restore the view.
162179
call winrestview(wsv)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1839,
764766
/**/
765767
1838,
766768
/**/

0 commit comments

Comments
 (0)