On So, 16 Jul 2017, Bram Moolenaar wrote:
> One correction:
>
> msgid "netbeans is not supported with this GUI\n"
> msgstr "netbeans wird in dieser GUI nicht unterstützt\n"
>
> msgstr was missing the "\n".
You have good eyes :)
Thanks and sorry for that.
How about the following change to check.vim:
This will also check for a missing \n at the end of msgstr lines (but
only for single message lines). Also, use winsaveview to remember the
cursor position and do not jump to the beginning of the file in case no
error was found.
diff --git a/src/po/check.vim b/src/po/check.vim
index 256c5387d..545d2548e 100644
--- a/src/po/check.vim
+++ b/src/po/check.vim
@@ -32,6 +32,7 @@ endfunc
" This only works when 'wrapscan' is not set.
let s:save_wrapscan = &wrapscan
+let wsv = winsaveview()
set nowrapscan
" Start at the first "msgid" line.
@@ -110,6 +111,14 @@ if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!')
endif
endif
+" Check that the \n at the end of the msid line is also present in the msgstr
+" line.
+1
+if error == 0 && search('msgid ".*\\n"\nmsgstr ".*\(\\n\)\@<!"\n\n') > 0
+ echomsg 'Missing "\\n" in line ' . (line('.')+1)
+ let error = (line('.')+1)
+endif
+
if error == 0
echomsg "OK"
else
@@ -117,6 +126,9 @@ else
endif
let &wrapscan = s:save_wrapscan
+if !error
+ call winrestview(wsv)
+endif
unlet s:save_wrapscan
endif
Best,
Christian
--
Das Lesen im Bett zeugt von völliger Hingabe an die Kunst: Man
überläßt es dem Dichter, wann man einschläft.
-- Ernst R. Hauschka