]> granicus.if.org Git - vim/commitdiff
patch 8.0.1839: script to check .po file doesn't check for plural header v8.0.1839
authorBram Moolenaar <Bram@vim.org>
Sun, 13 May 2018 20:37:03 +0000 (22:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 13 May 2018 20:37:03 +0000 (22:37 +0200)
Problem:    Script to check .po file doesn't check for plural header.
Solution:   Add a check that the plural header is present when needed.

src/po/check.vim
src/version.c

index 9cfa36a7cd9913ab3862f58ac512bc7c9b720ad6..24c4d79cb509cfecef30e24df85b738d8910c6ca 100644 (file)
@@ -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)
index 04d7814bc504b66b8ebe5370a468727f499f1cd4..a9348ef4e2dea32b382205d341a927ba72030f7d 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1839,
 /**/
     1838,
 /**/