annotate src/po/check.vim @ 13881:a0cf2482b430

Added tag v8.0.1811 for changeset 60e80884994d22b5cc2ff51af6299dd9f69301d8
author Christian Brabandt <cb@256bit.org>
date Thu, 10 May 2018 18:30:06 +0200
parents 9d6cd12ae7bc
children b9db0bc9b8f9
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.
13812
9d6cd12ae7bc patch 8.0.1778: script to check translations does not always work
Christian Brabandt <cb@256bit.org>
parents: 12756
diff changeset
124 1
11702
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
125 /^"MIME-Version:
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
126 while 1
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
127 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
128 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
129 break
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
130 endif
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
131 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
132 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
133 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
134 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
135 endif
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
136 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
137 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
138 " 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
139 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
140 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
141 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
142 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
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 endif
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
145 endwhile
48a95b916781 patch 8.0.0734: the script to check translations can be improved
Christian Brabandt <cb@256bit.org>
parents: 9963
diff changeset
146
11900
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
147 " 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
148 if executable("msgfmt")
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
149 let filename = expand("%")
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11910
diff changeset
150 " 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
151 " environment.
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11910
diff changeset
152 let $OLD_PO_FILE_INPUT = 'yes'
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11910
diff changeset
153 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
154 if v:shell_error != 0
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
155 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
156 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
157 endif
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
158 endif
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11828
diff changeset
159
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
160 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
161 " 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
162 call winrestview(wsv)
9963
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
163 echomsg "OK"
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
164 else
580f57b07547 commit https://github.com/vim/vim/commit/ec42059b78c1932a44f2bf36ac982109884dc7c7
Christian Brabandt <cb@256bit.org>
parents: 2484
diff changeset
165 exe error
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
166 endif
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
167
2484
e037ee8698b3 Set 'wrapscan' when checking the .po files. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents: 1952
diff changeset
168 let &wrapscan = s:save_wrapscan
e037ee8698b3 Set 'wrapscan' when checking the .po files. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents: 1952
diff changeset
169 unlet s:save_wrapscan
e037ee8698b3 Set 'wrapscan' when checking the .po files. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents: 1952
diff changeset
170
461
f98374445f66 updated for version 7.0123
vimboss
parents:
diff changeset
171 endif