1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
%D \module
%D [ file=lang-ini,
%D version=1996.01.25,
%D title=\CONTEXT\ Language Macros,
%D subtitle=Initialization,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
\unprotect
\registerctxluafile{lang-ini}{1.001}
\let\synchronizepatterns \relax % todo: cleanup
\let\synchronizepatternswithfont\relax % todo: cleanup
\def\mkdoloadpatterns#1#2%
{\ctxlua{languages.register(
"#1",
"#2",
"\truefilename{\f!languageprefix#2.\f!patternsextension}",
"\truefilename{\f!languageprefix#2.\f!hyphensextension }")
}}
\def\mkdoifpatternselse#1%
{\ctxlua{cs.testcase(languages.loadable("#1"))}}
\def\mkloadlanguagefiles#1%
{\doifelsevaluenothing{\??la#1\s!patterns}
{\mkdoloadpatterns{#1}{#1}}
{\mkdoloadpatterns{#1}{\getvalue{\??la#1\s!patterns}}}}
\def\mksetnormallanguage#1#2% current default / we can freeze the number here
{\normallanguage=\ctxlua{tex.sprint(languages.enable({
"\csname\??la#1\s!patterns\endcsname","#1",
"\csname\??la#2\s!patterns\endcsname","#2",
}))}\relax}
% to be tested
%
% \def\mkdosetnormallanguage#1#2% current default
% {\normallanguage=\ctxlua{tex.sprint(languages.enable({
% "\csname\??la#1\s!patterns\endcsname","#1",
% "\csname\??la#2\s!patterns\endcsname","#2",
% }))}}%
% \setxvalue{\??la\??la#1#2}{\number\normallanguage}}
%
% \def\mksetnormallanguage#1#2% current default / we can freeze the number here
% {\normallanguage\executeifdefined{\??la\??la#1#2}{\mkdosetnormallanguage{#1}{#2}}}
\def\loadspellchecklist
{\dodoubleempty\doloadspellchecklist}
% mkiv only -- todo: internationalize command names
% \loadspellchecklist[en][words-en.txt]
% \loadspellchecklist[nl][words-nl.txt]
% \setupspellchecking[state=start]
\def\loadspellchecklist[#1][#2]%
{\ctxlua{languages.words.load("#1","#2")}}
\def\setupspellchecking
{\dosingleargument\dosetupspellchecking}
\def\setupspellchecking[#1]% todo colors
{\getparameters[\??wl][#1]%
\doifelse\@@wlstate\v!start
{\ctxlua{languages.words.enable=true }}
{\ctxlua{languages.words.enable=false}}}
\setupspellchecking
[\c!state=\v!stop]
\uchyph=1
\protect \endinput
|