s-setups-missing.mkiv /size: 4151 b    last modification: 2020-07-01 14:35
1
% show missing translations
2 3
\startluacode
4
function
interfaces
.
show_missing
(
whatinterfaces
)
5
whatinterfaces
=
whatinterfaces
or
interfaces
.
interfaces
6
local
list
=
dofile
(
resolvers
.
find_file
(
"
mult-def.lua
"
)
)
7
local
NC
,
NR
,
HL
=
context
.
NC
,
context
.
NR
,
context
.
HL
8
for
k
,
v
in
table
.
sortedhash
(
list
)
do
9
context
.
title
(
k
)
10
context
.
starttabulate
{
string
.
rep
(
"
|
"
,
#
whatinterfaces
+
1
)
}
11
for
i
=
1
,
#
whatinterfaces
do
12
NC
(
)
13
context
(
whatinterfaces
[
i
]
)
14
end
15
NC
(
)
NR
(
)
HL
(
)
16
for
kk
,
vv
in
next
,
v
do
17
if
not
string
.
find
(
kk
,
"
subsub
"
)
then
18
local
okay
=
true
19
for
i
=
1
,
#
whatinterfaces
do
20
local
int
=
whatinterfaces
[
i
]
21
local
str
=
vv
[
int
]
22
if
not
str
or
(
int
~
=
"
en
"
and
str
=
=
vv
.
en
)
then
23
okay
=
false
24
break
25
end
26
end
27
if
not
okay
then
28
for
i
=
1
,
#
whatinterfaces
do
29
local
int
=
whatinterfaces
[
i
]
30
local
str
=
vv
[
int
]
31
context
.
NC
(
)
32
if
not
str
then
33
-- nothing
34
elseif
int
=
=
"
en
"
then
35
context
.
color
(
{
"
darkgreen
"
}
,
str
)
36
elseif
str
=
=
vv
.
en
then
37
context
.
color
(
{
"
darkred
"
}
,
str
)
38
elseif
int
=
=
"
pe
"
then
39
context
(
"
\\righttoleft
"
.
.
str
)
40
else
41
context
(
str
)
42
end
43
end
44
NC
(
)
NR
(
)
45
end
46
end
47
end
48
context
.
stoptabulate
(
)
49
end
50
end
51 52
function
interfaces
.
show_missing_messages
(
whatinterfaces
)
53
whatinterfaces
=
whatinterfaces
or
interfaces
.
interfaces
54
local
list
=
dofile
(
resolvers
.
find_file
(
"
mult-mes.lua
"
)
)
55
local
NC
,
NR
,
HL
=
context
.
NC
,
context
.
NR
,
context
.
HL
56
for
k
,
v
in
table
.
sortedhash
(
list
)
do
57
context
.
title
(
"
message:
"
.
.
k
)
58
context
.
starttabulate
{
"
|l|
"
.
.
string
.
rep
(
"
pl|
"
,
#
whatinterfaces
)
}
59
NC
(
)
60
for
i
=
1
,
#
whatinterfaces
do
61
NC
(
)
62
context
(
whatinterfaces
[
i
]
)
63
end
64
NC
(
)
NR
(
)
HL
(
)
65
local
sorted
=
table
.
sortedkeys
(
v
)
66
for
i
=
1
,
#
sorted
do
67
local
kk
=
sorted
[
i
]
68
local
vv
=
v
[
kk
]
69
if
kk
~
=
"
files
"
then
70
local
okay
=
true
71
for
i
=
1
,
#
whatinterfaces
do
72
local
int
=
whatinterfaces
[
i
]
73
local
str
=
vv
[
int
]
74
if
not
str
or
(
int
~
=
"
en
"
and
str
=
=
vv
.
en
)
then
75
okay
=
false
76
break
77
end
78
end
79
if
not
okay
then
80
context
.
NC
(
)
81
context
(
kk
)
82
for
i
=
1
,
#
whatinterfaces
do
83
local
int
=
whatinterfaces
[
i
]
84
local
str
=
vv
[
int
]
85
NC
(
)
86
if
not
str
then
87
-- nothing
88
elseif
int
=
=
"
en
"
then
89
context
.
color
(
{
"
darkgreen
"
}
,
str
)
90
elseif
str
=
=
vv
.
en
then
91
context
.
color
(
{
"
darkred
"
}
,
str
)
92
elseif
int
=
=
"
pe
"
then
93
context
(
"
\\righttoleft
"
.
.
str
)
94
else
95
context
(
str
)
96
end
97
end
98
NC
(
)
NR
(
)
99
end
100
end
101
end
102
context
.
stoptabulate
(
)
103
end
104
end
105
\stopluacode
106 107
\starttext
108 109
\setupbodyfont
[
dejavu
,
7
pt
,
tt
]
110
\setuppapersize
[
A
4
,
landscape
][
A
4
,
landscape
]
111
\setuplayout
[
backspace
=
.
5
cm
,
width
=
middle
,
topspace
=
.
5
cm
,
height
=
middle
,
header
=
1
cm
,
footer
=
0
cm
]
112 113
\startluacode
114
interfaces
.
show_missing
(
)
-- { "en","nl" }
115
interfaces
.
show_missing_messages
(
)
-- { "en","nl" }
116
\stopluacode
117 118
\stoptext
119