annotate src/po/check.vim @ 13074:66c014c71dad v8.0.1412

patch 8.0.1412: using free memory using setloclist() commit https://github.com/vim/vim/commit/12237448499aaeb8c4f2be7a1deda60c0f160627 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 19 12:38:52 2017 +0100 patch 8.0.1412: using free memory using setloclist() Problem: Using free memory using setloclist(). (Dominique Pelle) Solution: Mark location list context as still in use when needed. (Yegappan Lakshmanan, closes #2462)
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Dec 2017 12:45:06 +0100
parents 3b26420fc639
children 9d6cd12ae7bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
1 " Vim script for checking .po files.
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
2 "
1599
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
3 " Go through the file and verify that:
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
4 " - All %...s items in "msgid" are identical to the ones in "msgstr".
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
5 " - An error or warning code in "msgid" matches the one in "msgstr".
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
6
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
7 if 1 " Only execute this if the eval feature is available.
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
8
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
9 " Function to get a split line at the cursor.
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
10 " Used for both msgid and msgstr lines.
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
11 " Removes all text except % items and returns the result.
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
12 func! GetMline()
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
13 let idline = substitute(getline('.'), '"\(.*\)"$', '\1', '')
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
14 while line('.') < line('$')
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
15 +
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
16 let line = getline('.')
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
17 if line[0] != '"'
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
18 break
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
19 endif
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
20 let idline .= substitute(line, '"\(.*\)"$', '\1', '')
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
21 endwhile
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
22
557
862863033fdd updated for version 7.0158
vimboss
parents: 461
diff changeset
23 " remove '%', not used for formatting.
862863033fdd updated for version 7.0158
vimboss
parents: 461
diff changeset
24 let idline = substitute(idline, "'%'", '', 'g')
862863033fdd updated for version 7.0158
vimboss
parents: 461
diff changeset
25
1952
6ddd55ac6ce5 updated for version 7.2-249
vimboss
parents: 1599
diff changeset
26 " remove '%' used for plural forms.
6ddd55ac6ce5 updated for version 7.2-249
vimboss
parents: 1599
diff changeset
27 let idline = substitute(idline, '\\nPlural-Forms: .\+;\\n', '', '')
6ddd55ac6ce5 updated for version 7.2-249
vimboss
parents: 1599
diff changeset
28
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
29 " remove everything but % items.
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
30 return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g')
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
31 endfunc
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
32
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
33 " This only works when 'wrapscan' is not set.
2484
e037ee8698b3 Set 'wrapscan' when checking the .po files. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents: 1952
diff changeset
34 let s:save_wrapscan = &wrapscan
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
35 set nowrapscan
2484
e037ee8698b3 Set 'wrapscan' when checking the .po files. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents: 1952
diff changeset
36
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
37 " Start at the first "msgid" line.
11702
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
38 let wsv = winsaveview()
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
39 1
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
40 /^msgid\>
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
41
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
42 " When an error is detected this is set to the line number.
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
43 " Note: this is used in the Makefile.
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
44 let error = 0
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
45
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
46 while 1
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
47 if getline(line('.') - 1) !~ "no-c-format"
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
48 " go over the "msgid" and "msgid_plural" lines
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
49 let prevfromline = 'foobar'
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
50 while 1
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
51 let fromline = GetMline()
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
52 if prevfromline != 'foobar' && prevfromline != fromline
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
53 echomsg 'Mismatching % in line ' . (line('.') - 1)
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
54 echomsg 'msgid: ' . prevfromline
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
55 echomsg 'msgid ' . fromline
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
56 if error == 0
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
57 let error = line('.')
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
58 endif
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
59 endif
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
60 if getline('.') !~ 'msgid_plural'
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
61 break
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
62 endif
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
63 let prevfromline = fromline
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
64 endwhile
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
65
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
66 if getline('.') !~ '^msgstr'
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
67 echomsg 'Missing "msgstr" in line ' . line('.')
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
68 if error == 0
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
69 let error = line('.')
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
70 endif
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
71 endif
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
72
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
73 " check all the 'msgstr' lines
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
74 while getline('.') =~ '^msgstr'
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
75 let toline = GetMline()
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
76 if fromline != toline
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
77 echomsg 'Mismatching % in line ' . (line('.') - 1)
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
78 echomsg 'msgid: ' . fromline
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
79 echomsg 'msgstr: ' . toline
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
80 if error == 0
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
81 let error = line('.')
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
82 endif
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
83 endif
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
84 if line('.') == line('$')
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
85 break
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
86 endif
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
87 endwhile
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
88 endif
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
89
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
90 " Find next msgid. Quit when there is no more.
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
91 let lnum = line('.')
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
92 silent! /^msgid\>
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
93 if line('.') == lnum
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
94 break
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
95 endif
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
96 endwhile
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
97
1599
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
98 " Check that error code in msgid matches the one in msgstr.
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
99 "
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
100 " Examples of mismatches found with msgid "E123: ..."
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
101 " - msgstr "E321: ..." error code mismatch
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
102 " - msgstr "W123: ..." warning instead of error
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
103 " - msgstr "E123 ..." missing colon
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
104 " - msgstr "..." missing error code
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
105 "
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
106 1
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
107 if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
108 echomsg 'Mismatching error/warning code in line ' . line('.')
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
109 if error == 0
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
110 let error = line('.')
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
111 endif
1599
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
112 endif
2f016b638c0c updated for version 7.1-312
vimboss
parents: 557
diff changeset
113
11702
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
114 func! CountNl(first, last)
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
115 let nl = 0
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
116 for lnum in range(a:first, a:last)
11828
5a07a3ff56c1 patch 8.0.0794: checking translations fails with multiple NL
Christian Brabandt <cb@256bit.org>
parents: 11702
diff changeset
117 let nl += count(getline(lnum), "\n")
11702
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
118 endfor
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
119 return nl
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
120 endfunc
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
121
11828
5a07a3ff56c1 patch 8.0.0794: checking translations fails with multiple NL
Christian Brabandt <cb@256bit.org>
parents: 11702
diff changeset
122 " Check that the \n at the end of the msgid line is also present in the msgstr
11702
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
123 " line. Skip over the header.
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
124 /^"MIME-Version:
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
125 while 1
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
126 let lnum = search('^msgid\>')
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
127 if lnum <= 0
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
128 break
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
129 endif
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
130 let strlnum = search('^msgstr\>')
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
131 let end = search('^$')
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
132 if end <= 0
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
133 let end = line('$') + 1
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
134 endif
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
135 let origcount = CountNl(lnum, strlnum - 1)
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
136 let transcount = CountNl(strlnum, end - 1)
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
137 " Allow for a few more or less line breaks when there are 2 or more
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
138 if origcount != transcount && (origcount <= 2 || transcount <= 2)
11828
5a07a3ff56c1 patch 8.0.0794: checking translations fails with multiple NL
Christian Brabandt <cb@256bit.org>
parents: 11702
diff changeset
139 echomsg 'Mismatching "\n" in line ' . line('.')
11702
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
140 if error == 0
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
141 let error = lnum
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
142 endif
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
143 endif
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
144 endwhile
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
145
11900
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
146 " Check that the file is well formed according to msgfmts understanding
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
147 if executable("msgfmt")
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
148 let filename = expand("%")
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11910
diff changeset
149 " Newer msgfmt does not take OLD_PO_FILE_INPUT argument, must be in
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11910
diff changeset
150 " environment.
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11910
diff changeset
151 let $OLD_PO_FILE_INPUT = 'yes'
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11910
diff changeset
152 let a = system("msgfmt --statistics " . filename)
11900
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
153 if v:shell_error != 0
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
154 let error = matchstr(a, filename.':\zs\d\+\ze:')+0
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
155 for line in split(a, '\n') | echomsg line | endfor
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
156 endif
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
157 endif
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
158
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
159 if error == 0
11702
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
160 " If all was OK restore the view.
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
161 call winrestview(wsv)
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
162 echomsg "OK"
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
163 else
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
164 exe error
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
165 endif
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
166
2484
e037ee8698b3 Set 'wrapscan' when checking the .po files. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents: 1952
diff changeset
167 let &wrapscan = s:save_wrapscan
e037ee8698b3 Set 'wrapscan' when checking the .po files. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents: 1952
diff changeset
168 unlet s:save_wrapscan
e037ee8698b3 Set 'wrapscan' when checking the .po files. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents: 1952
diff changeset
169
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
170 endif