lang-ini.mkiv /size: 23 Kb    last modification: 2021-10-28 13:50
1%D \module
2%D   [       file=lang-ini,
3%D        version=1996.01.25,
4%D          title=\CONTEXT\ Language Macros,
5%D       subtitle=Initialization,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D This module needs a further cleanup (real split between ii/iv).
15
16% \cldcontext{languages.numbers[tex.count.mainlanguagenumber]}
17
18%D This module implements multi||language support of \CONTEXT, which should not be
19%D confused with the multi||lingual interface. This support will be extended when
20%D needed. Properties of languages are defined in \TEX\ files as well as \LUA\
21%D files.
22
23\writestatus{loading}{ConTeXt Language Macros / Initialization}
24
25\registerctxluafile{lang-ini}{}
26\registerctxluafile{lang-def}{}
27\registerctxluafile{lang-cnt}{}
28
29\unprotect
30
31\ifdefined\nonfrenchspacing\else \let\nonfrenchspacing\relax \fi
32\ifdefined\frenchspacing   \else \let\frenchspacing   \relax \fi
33
34%D When loading hyphenation patterns, \TEX\ assign a number to each loaded table,
35%D starting with~0. Switching to a specific table is done by assigning the relevant
36%D number to the predefined \COUNTER\ \type {\language}. However, in \MKIV\ a lot
37%D of management is delegated to \LUA.
38
39%D We keep track of the last loaded patterns by means of a pseudo \COUNTER. This
40%D just one of those situations in which we don't want to spent a real one. Language
41%D zero has no patterns, first of all because I like to start numbering at one. It
42%D may come in handy for special purposes as well.
43
44\normallanguage\zerocount \def\loadedlanguage{1}
45
46%D \macros
47%D   {currentlanguage, setupcurrentlanguage}
48%D
49%D Instead of numbers,we are going to use symbolic names for the languages. The
50%D current langage is saved in the macro \type {\currentlanguage}. The setup macro
51%D is mainly used for cosmetic purposes.
52%D
53%D \starttyping
54%D \dorecurse{3}
55%D   {\language[nl]
56%D    \startmode[*en] english \stopmode
57%D    \startmode[*nl] dutch   \stopmode
58%D    \language[en]
59%D    \startmode[*en] english \stopmode
60%D    \startmode[*nl] dutch   \stopmode}
61%D \stoptyping
62
63\let\currentlanguage    \empty
64\let\currentmainlanguage\empty
65
66%D \macros
67%D   {defaultlanguage,languageparameter,specificlanguageparameter}
68%D
69%D We don't use the commandhandler here (yet) because we have a rather special
70%D fallback mechanism so quite some compatibility testing is needed.
71
72\installcorenamespace{language}
73\installcorenamespace{languagelinked}
74
75\def\currentusedlanguage{\currentlanguage}
76
77\def\defaultlanguage#1%
78  {\ifcsname\??language#1\s!default\endcsname
79     \expandafter\defaultlanguage\lastnamedcs
80   \else
81     #1%
82   \fi}
83
84\def\languageparameter#1%
85  {\ifcsname\??language\currentlanguage#1\endcsname
86     \lastnamedcs
87   \else\ifcsname\??language\currentlanguage\s!default\endcsname
88     \expandafter\specificlanguageparameter\lastnamedcs{#1}%
89   \else\ifcsname\??language\s!default#1\endcsname
90     \lastnamedcs
91   \fi\fi\fi}
92
93\def\specificlanguageparameter#1#2%
94  {\ifcsname\??language#1#2\endcsname
95     \lastnamedcs
96   \else\ifcsname\??language#1\s!default\endcsname
97     \expandafter\specificlanguageparameter\lastnamedcs{#2}%
98   \else\ifcsname\??language\s!default#2\endcsname
99     \lastnamedcs
100   \fi\fi\fi}
101
102\def\mainlanguageparameter#1%
103  {\ifcsname\??language\currentmainlanguage#1\endcsname
104     \lastnamedcs
105   \else\ifcsname\??language\currentmainlanguage\s!default\endcsname
106     \expandafter\specificlanguageparameter\lastnamedcs{#1}%
107   \else\ifcsname\??language\s!default#1\endcsname
108     \lastnamedcs
109   \fi\fi\fi}
110
111\let\usedlanguageparameter\languageparameter
112
113\def\askedlanguageparameter#1% assumes \currentusedlanguage being set
114  {\ifcsname\??language\currentusedlanguage#1\endcsname
115     \lastnamedcs
116   \else\ifcsname\??language\currentusedlanguage\s!default\endcsname
117     \expandafter\specificlanguageparameter\lastnamedcs{#1}%
118   \else\ifcsname\??language\s!default#1\endcsname
119     \lastnamedcs
120   \fi\fi\fi}
121
122\unexpanded\def\setusedlanguage#1%
123  {\edef\currentusedlanguage{\reallanguagetag{#1}}%
124   \ifx\currentusedlanguage\empty
125     \let\currentusedlanguage  \currentlanguage
126     \let\usedlanguageparameter\languageparameter
127   \else\ifx\currentusedlanguage\v!global
128     \let\currentusedlanguage  \currentmainlanguage
129     \let\usedlanguageparameter\mainlanguageparameter
130   \else\ifx\currentusedlanguage\v!local
131     \let\currentusedlanguage  \currentlanguage
132     \let\usedlanguageparameter\languageparameter
133   \else
134     \let\usedlanguageparameter\askedlanguageparameter
135   \fi\fi\fi}
136
137\unexpanded\def\setupcurrentlanguage[#1]%
138  {\setcurrentlanguage\currentmainlanguage{#1}}
139
140\unexpanded\def\setcurrentlanguage#1#2% sets modes: **id (currentmain) *id (current)
141  {\edef\xaskedlanguage{#1}% otherwise clash with \askedlanguage
142   \ifx\xaskedlanguage\empty \else
143     \ifx\currentmainlanguage\empty\else\resetsystemmode{\systemmodeprefix\currentmainlanguage}\fi
144     \let\currentmainlanguage\xaskedlanguage
145     \setsystemmode{\systemmodeprefix\currentmainlanguage}%
146   \fi
147   \edef\xaskedlanguage{#2}%
148   \ifx\xaskedlanguage\empty \else
149     \ifx\currentlanguage\empty\else\resetsystemmode\currentlanguage\fi
150     \let\currentlanguage\xaskedlanguage
151     \setsystemmode\currentlanguage
152   \fi}
153
154%D The internal macros will be defined later.
155
156%D \macros
157%D   {installlanguage}
158%D
159%D Hyphenation patterns can only be loaded when the format file is prepared. The
160%D next macro takes care of this loading. A language is specified with
161%D
162%D \showsetup{installlanguage}
163%D
164%D When \type {state} equals \type {start}, both patterns and additional hyphenation
165%D specifications are loaded. These files are seached for in the patterns path
166%D have names like \type {lang-nl.lua}.
167%D
168%D The \type {spacing} variable specifies how the spaces after punctuation has to be
169%D handled. English is by tradition more tolerant to inter||sentence spacing than
170%D other languages.
171%D
172%D This macro also defines \type {\identifier} as a shortcut switch to the language.
173%D Furthermore the command defined as being language specific, are executed. With
174%D \type {default} we can default to another language (patterns) at format
175%D generation time. Patterns are loaded at runtime.
176
177\newtoks \everysetuplanguage
178
179\def\installedlanguages{\clf_installedlanguages}
180
181\unexpanded\def\doifelselanguage#1%
182  {\ifcsname\??language#1\c!state\endcsname
183     \expandafter\firstoftwoarguments
184   \else
185     \expandafter\secondoftwoarguments
186   \fi}
187
188\let\doiflanguageelse\doifelselanguage
189
190\def\reallanguagetag#1%
191  {\ifcsname\??languagelinked#1\endcsname\lastnamedcs\else#1\fi}
192
193% \language[#1] gave unwanted side effect of loading language specifics
194
195\unexpanded\def\installlanguage
196  {\dodoubleargument\lang_basics_install}
197
198% \def\lang_basics_install[#1][#2]%
199%   {\doifelseassignment{#2}
200%      {\doifelselanguage{#1}
201%         {\getparameters[\??language#1][#2]}
202%         {\setvalue{\??languagelinked#1}{#1}%
203%          \lang_basics_install_indeed{#1}{#1}%
204%          \getparameters[\??language#1][\c!state=\v!start,#2]}%
205%       \edef\currentsetuplanguage{#1}%
206%       \clf_definelanguage{#1}{\specificlanguageparameter{#1}\s!default}%
207%       \the\everysetuplanguage}
208%      {\setvalue{\??languagelinked#1}{#2}%
209%       \clf_setlanguagesynonym{#1}{#2}%
210%       \lang_basics_install_indeed{#1}{#2}}}
211
212\def\lang_basics_install[#1][#2]%
213  {\ifcondition\validassignment{#2}%
214     \doifelselanguage{#1}
215       {\getparameters[\??language#1][#2]}
216       {\setvalue{\??languagelinked#1}{#1}%
217        \lang_basics_install_indeed{#1}{#1}%
218        \getparameters[\??language#1][\c!state=\v!start,#2]}%
219     \edef\currentsetuplanguage{#1}%
220     \clf_definelanguage{#1}{\specificlanguageparameter{#1}\s!default}%
221     \the\everysetuplanguage
222   \else
223     \setvalue{\??languagelinked#1}{#2}%
224     \clf_setlanguagesynonym{#1}{#2}%
225     \lang_basics_install_indeed{#1}{#2}%
226  \fi}
227
228\def\lang_basics_install_indeed#1#2%
229  {\ifcsname#1\endcsname\else\setuvalue{#1}{\lang_basics_set_current[#2]}\fi}
230
231%D When the second argument is a language identifier, a synonym is created. This
232%D feature is present because we used dutch mnemonics in the dutch version, but
233%D nowadays conform a standard.
234
235\unexpanded\def\doifelsepatterns#1%
236  {\begingroup % will change
237   \lang_basics_set_current[#1]%
238   \ifnum\normallanguage>\zerocount
239     \endgroup\expandafter\firstoftwoarguments
240   \else
241     \endgroup\expandafter\secondoftwoarguments
242   \fi}
243
244\let\doifpatternselse\doifelsepatterns
245
246%D \macros
247%D   {setuplanguage}
248%D
249%D Quick and dirty, but useful:
250%D
251%D \showsetup{setuplanguage}
252%D
253%D Beware, this command can only be used when a language is installed.
254
255\unexpanded\def\setuplanguage
256  {\dodoubleempty\lang_basics_setup}
257
258\ifdefined\lang_basics_synchronize \else
259    \let\lang_basics_synchronize\relax % be nice for setups till we have one
260\fi
261
262\installmacrostack\currentlanguage
263
264\def\lang_basics_setup[#1][#2]%
265  {\ifsecondargument
266     \push_macro_currentlanguage % can be default
267     \edef\currentsetuplanguage{\reallanguagetag{#1}}%
268     \getparameters[\??language\currentsetuplanguage][#2]%
269     \the\everysetuplanguage
270     \pop_macro_currentlanguage
271    %\doif\currentsetuplanguage\currentlanguage we can have influenced inheritance (default)
272   \else
273     \let\currentsetuplanguage\currentlanguage
274     \getparameters[\??language\currentsetuplanguage][#1]%
275     \the\everysetuplanguage
276   \fi
277   \lang_basics_synchronize}
278
279\appendtoks
280    \clf_unloadlanguage{\currentsetuplanguage}%
281\to \everysetuplanguage
282
283\setuplanguage
284  [\s!default]
285  [\s!patterns=,
286   \s!lefthyphenmin=2,
287   \s!righthyphenmin=2,
288   \s!lefthyphenchar=-1,
289   \s!righthyphenchar=45,
290   % used in compound i.e. interfaced with c! and can be anything so no numbers
291   \c!lefthyphen=,
292   \c!righthyphen=-,
293   \c!hyphen=-,
294   \c!spacing=\v!packed,
295   \c!compoundhyphen=\compoundhyphen,
296   \c!rightcompoundhyphen=\compoundhyphen,
297   \c!leftcompoundhyphen=,
298   \c!midsentence=---,
299   \c!leftsentence=---,
300   \c!rightsentence=---,
301   \c!leftsubsentence=---,
302   \c!rightsubsentence=---,
303   \c!leftquote=\upperleftsinglesixquote,
304   \c!rightquote=\upperrightsingleninequote,
305   \c!leftquotation=\upperleftdoublesixquote,
306   \c!rightquotation=\upperrightdoubleninequote,
307   \c!leftspeech=\languageparameter\c!leftquotation,
308   \c!middlespeech=,
309   \c!rightspeech=\languageparameter\c!rightquotation,
310   \c!limittext=\unknown,
311   \c!time={h,:,m},
312   \c!date={\v!year,\ ,\v!month,\ ,\v!day},
313   \c!text=Ag,
314   \c!font=] % \v!auto : experimental !
315
316% to be tested:
317%
318% \setuplanguage
319%   [\s!default]
320%   [\c!righthyphenchar="AD]
321
322%D The values \type {leftsentence} and \type {rightsentence} can be (and are) used
323%D to implement automatic subsentence boundary glyphs, like in {\fr |<|french
324%D guillemots|>|} or {\de |<|german guillemots|>|} or {\nl |<|dutch dashes|>|} like
325%D situations. Furthermore \type {leftquotation} and \type {leftquote} come into
326%D view \quotation {when we quote} or \quote {quote} something.
327
328%D \macros
329%D  {currentdatespecification, currenttimespecification}
330%D
331%D Just to make things easy we can ask for the current date specification by saying:
332
333\def\currentdatespecification{\languageparameter\c!date}
334\def\currenttimespecification{\languageparameter\c!time}
335
336%D Carefull reading of these macros shows that it's legal to say
337%D
338%D \starttyping
339%D \installlanguage [du] [de]
340%D \stoptyping
341
342%D \macros
343%D   {language,mainlanguage}
344%D
345%D Switching to another language (actually another hyphenation pattern) is done
346%D with:
347%D
348%D \starttyping
349%D \language[identifier]
350%D \stoptyping
351%D
352%D or with \type {\identifier}. Just to be compatible with \PLAIN\ \TEX, we still
353%D support the original meaning, so
354%D
355%D \starttyping
356%D \language=1
357%D \stoptyping
358%D
359%D is a valid operation, where the relation between number and language depends on
360%D the order in installing languages.
361%D
362%D \showsetup{language}
363%D \showsetup{mainlanguage}
364%D
365%D Both commands take a predefined language identifier as argument. We can use \type
366%D {\mainlanguage[identifier]} for setting the (indeed) main language. This is the
367%D language used for translating labels like {\em figure} and {\em table}. The main
368%D language defaults to the current language.
369
370\newtoks \everylanguage
371
372\installcorenamespace{languagenumbers}
373
374\appendtoks
375    % we need to reassign the number because new patterns can be defined later on
376    % so let's hope not that many \setups happen during a run
377    \expandafter\glet\csname\??languagenumbers\currentlanguage\endcsname\undefined
378\to \everysetuplanguage
379
380\def\lang_basics_synchronize_yes
381  {\zerocount % see below
382   \global\expandafter\chardef\csname\??languagenumbers\currentlanguage\endcsname
383      \clf_languagenumber
384        {\currentlanguage}%
385        {\defaultlanguage\currentlanguage}%
386        {\languageparameter\s!patterns}%
387        {\languageparameter\c!factor}%
388      \relax
389   \normallanguage\csname\??languagenumbers\currentlanguage\endcsname}
390
391\let\lang_basics_synchronize_nop\zerocount % not loaded anyway
392
393\letvalue{\??languagenumbers}\lang_basics_synchronize_nop % initime
394
395\appendtoks
396    \letvalue{\??languagenumbers}\lang_basics_synchronize_yes % runtime
397\to \everydump
398
399\def\lang_basics_synchronize
400  {\normallanguage\csname\??languagenumbers
401     \ifcsname\??languagenumbers\currentlanguage\endcsname
402       \currentlanguage
403     \fi
404   \endcsname
405   \relax
406   \the\everylanguage
407   \relax}
408
409\newcount\hyphenstate
410\newcount\hyphenminoffset
411
412\unexpanded\def\lesshyphens
413  {\advance\hyphenminoffset\plusone
414   \lang_basics_synchronize_min_max}
415
416\unexpanded\def\morehyphens
417  {\ifcase\hyphenminoffset \else
418     \advance\hyphenminoffset\minusone
419   \fi
420   \lang_basics_synchronize_min_max}
421
422\unexpanded\def\nohyphens % nicer for url's
423  {\ifx\dohyphens\relax
424     \unexpanded\edef\dohyphens
425       {\hyphenminoffset\the\hyphenminoffset\relax
426        \lang_basics_synchronize_min_max}%
427   \fi
428   \hyphenminoffset\plusthousand
429   \lang_basics_synchronize_min_max}
430
431\let\dohyphens\relax
432
433\unexpanded\def\usehyphensparameter#1%
434  {\edef\p_hyphens{#1\c!hyphens}%
435   \ifx\p_hyhens\v!no
436     \nohyphens
437   \fi}
438
439\unexpanded\def\lang_basics_synchronize_min_max % maybe store this at the lua end
440  {% these values are stored along with glyph nodes
441   \lefthyphenmin \numexpr0\languageparameter\s!lefthyphenmin +\hyphenminoffset\relax
442   \righthyphenmin\numexpr0\languageparameter\s!righthyphenmin+\hyphenminoffset\relax
443   \hyphenationmin\numexpr0\languageparameter\s!hyphenmin\relax
444   % these values are stored with the language (global!)
445   \prehyphenchar \languageparameter\s!righthyphenchar\relax
446   \posthyphenchar\languageparameter\s!lefthyphenchar \relax}
447
448\appendtoks
449    \lang_basics_synchronize_min_max
450\to \everylanguage
451
452\unexpanded\def\unhyphenated
453  {\groupedcommand{\lefthyphenmin\maxdimen}\donothing}
454
455% \appendtoks
456%     \setups[\languageparameter\c!setups]%
457% \to \everylanguage
458
459%D You can setup the default language to reset settings.
460
461\appendtoks
462    \edef\currentlanguagesetups{\languageparameter\c!setups}%
463    \ifx\currentlanguagesetups\empty \else
464        \setups[\currentlanguagesetups]%
465    \fi
466\to \everylanguage
467
468% new
469
470\appendtoks
471    \usebidiparameter\languageparameter
472\to \everylanguage
473
474% this will move to core-spa !
475
476\appendtoks
477    \edef\p_spacing{\languageparameter\c!spacing}%
478    \ifx\p_spacing\v!broad
479      \nonfrenchspacing
480    \else
481      \frenchspacing
482    \fi
483\to \everylanguage
484
485% \mainlanguage[nl] \setuplanguage[nl][lefthyphen=,righthyphen=?]
486%
487% \dorecurse{100}{dit is toch wel een heel\normalhyphendiscretionary lang\normalhyphendiscretionary woord \recurselevel\ }
488% \dorecurse{100}{dit is toch wel een heellangwoord \recurselevel\ }
489
490% new experimental feature
491
492\unexpanded\def\setuplanguages
493  {\setuplanguage[\s!default]}
494
495% \setuplanguages[\c!font=\v!auto]
496% \setuplanguage[\s!default][\c!font=\v!auto]
497% \setuplanguage[nl][\c!font=\v!auto]
498
499\appendtoks
500    \edef\p_language_font{\languageparameter\c!font}%
501    \ifx\p_language_font\empty\else
502      \ifx\p_language_font\v!auto
503        \doaddfeature\currentlanguage
504      \else
505        \doaddfeature\p_language_font
506      \fi
507    \fi
508\to \everylanguage
509
510%D Fast switcher
511
512\def\lang_basics_switch_asked
513  {\ifcsname\??languagelinked\askedlanguage\endcsname
514     \edef\askedlanguage{\lastnamedcs}%
515     \ifx\currentlanguage\askedlanguage \else
516       \setcurrentlanguage\currentmainlanguage\askedlanguage
517       \lang_basics_synchronize
518     \fi
519   \fi}
520
521\unexpanded\def\uselanguageparameter#1%
522  {\edef\askedlanguage{#1\c!language}%
523   \ifx\askedlanguage\empty\else\lang_basics_switch_asked\fi}
524
525\unexpanded\def\douselanguageparameter#1% fast setter
526  {\edef\askedlanguage{#1}%
527   \ifx\askedlanguage\empty\else\lang_basics_switch_asked\fi}
528
529\unexpanded\def\lang_basics_set_current[#1]%
530  {\edef\askedlanguage{#1}%
531   \ifx\askedlanguage\empty\else\lang_basics_switch_asked\fi}
532
533\unexpanded\def\language
534  {\doifelsenextoptionalcs\lang_basics_set_current\normallanguage}
535
536\let\setlanguage\language % we make these synonyms
537
538\let\patterns\gobbleoneargument
539
540\newcount\mainlanguagenumber
541
542%D Beware: you might need to use \type {\dontleavehmode} outside and|/|or \type {\par}
543%D inside the group!
544
545\unexpanded\def\startlanguage
546  {\begingroup\language}
547
548\let\stoplanguage\endgroup
549
550\unexpanded\def\mainlanguage[#1]%
551  {\edef\askedlanguage{#1}%
552   \ifx\askedlanguage\empty \else
553     \ifcsname\??languagelinked\askedlanguage\endcsname
554      %\edef\askedlanguage{\csname\??languagelinked\askedlanguage\endcsname}%
555       \edef\askedlanguage{\lastnamedcs}%
556       \ifx\currentlanguage\askedlanguage
557         \ifx\currentmainlanguage\askedlanguage \else
558           \setcurrentlanguage\askedlanguage\askedlanguage
559           \lang_basics_synchronize
560         \fi
561       \else
562         \setcurrentlanguage\askedlanguage\askedlanguage
563         \lang_basics_synchronize
564       \fi
565     \fi
566   \fi
567   \mainlanguagenumber\normallanguage}
568
569\appendtoks
570    \normallanguage\mainlanguagenumber
571\to \everybeforepagebody
572
573%D Used at all?
574
575\def\splitsequence#1#2%
576  {\doifelse{#1}\v!no{#2}{\doifelse{#1}\v!yes{\languageparameter\c!limittext}{#1}}}
577
578\def\splitsymbol#1%
579  {\splitsequence{#1}{\languageparameter\c!limittext}}
580
581%D Just like with subsentence boundary symbols, quotes placement depends on the
582%D current language, therefore we show the defaults here.
583%D
584%D \def\ShowLanguageValues [#1] [#2] #3 #4
585%D   {\blank
586%D    \startlinecorrection
587%D    \vbox\bgroup
588%D    \language[#1]
589%D    \midaligned{\bf#2 subsentence symbol and quotes}
590%D    \framed[width=\hsize,frame=off,topframe=on,bottomframe=on,offset=.5ex]
591%D      {\hfil\quotation{#3 #4}\hfil\quote{#2}\hfil
592%D       \startsubsentence\startsubsentence#3\stopsubsentence#4\stopsubsentence\hfil}
593%D    \egroup
594%D    \stoplinecorrection
595%D    \blank}
596%D
597%D \ShowLanguageValues [af] [afrikaans]  afrikaanse ...
598%D \ShowLanguageValues [ca] [catalan]    catalan ...
599%D \ShowLanguageValues [cs] [czech]      tjechisch tex
600%D \ShowLanguageValues [cs] [slovak]     slowaakse ...
601%D \ShowLanguageValues [da] [danish]     deense ...
602%D \ShowLanguageValues [de] [german]     duitse degelijkheid
603%D \ShowLanguageValues [en] [english]    engelse humor
604%D \ShowLanguageValues [et] [estonian]   ...
605%D \ShowLanguageValues [fi] [finnish]    finse ...
606%D \ShowLanguageValues [fr] [french]     franse slag
607%D \ShowLanguageValues [it] [italian]    italiaanse ...
608%D \ShowLanguageValues [la] [latin]      latijnse missen
609%D \ShowLanguageValues [nl] [dutch]      nederlandse zuinigheid
610%D \ShowLanguageValues [nb] [bokmal]     noorse zalm
611%D \ShowLanguageValues [nn] [nnynorsk]   noorse zalm
612%D \ShowLanguageValues [pl] [polish]     poolse vlag
613%D \ShowLanguageValues [pt] [portuguese] portugese ...
614%D \ShowLanguageValues [es] [spanish]    spaans benauwd
615%D \ShowLanguageValues [sv] [swedish]    zweedse ...
616%D \ShowLanguageValues [tr] [turkish]    turks fruit
617
618%D We support a lot of languages. These are specified and loaded in separate files,
619%D according to their roots. Here we only take care of (postponed) setting of the
620%D current language.
621%D
622%D \unprotect
623%D \placetable{The germanic languages (\type{lang-ger})}
624%D \starttable[||||]
625%D \HL
626%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
627%D \HL
628%D \NC \s!nl        \NC dutch        \NC germanic  \NC\FR
629%D \NC \s!en        \NC english      \NC germanic  \NC\MR
630%D \NC \s!de        \NC german       \NC germanic  \NC\MR
631%D \NC \s!da        \NC danish       \NC germanic  \NC\MR
632%D \NC \s!sv        \NC swedish      \NC germanic  \NC\MR
633%D \NC \s!af        \NC afrikaans    \NC germanic  \NC\MR
634%D \NC \s!nb        \NC bokmal       \NC germanic  \NC\LR
635%D \NC \s!nn        \NC nynorsk      \NC germanic  \NC\LR
636%D \HL
637%D \stoptable
638%D \protect
639%D
640%D \unprotect
641%D \placetable{The italic languages (\type{lang-ita})}
642%D \starttable[||||]
643%D \HL
644%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
645%D \HL
646%D \NC \s!fr        \NC french       \NC italic    \NC\FR
647%D \NC \s!ca        \NC catalan      \NC italic    \NC\MR
648%D \NC \s!es        \NC spanish      \NC italic    \NC\MR
649%D \NC \s!it        \NC italian      \NC italic    \NC\MR
650%D \NC \s!la        \NC latin        \NC italic    \NC\MR
651%D \NC \s!pt        \NC portuguese   \NC italic    \NC\LR
652%D \HL
653%D \stoptable
654%D \protect
655%D
656%D \unprotect
657%D \placetable{The slavic languages (\type{lang-sla})}
658%D \starttable[||||]
659%D \HL
660%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
661%D \HL
662%D \NC \s!pl        \NC polish       \NC slavic    \NC\FR
663%D \NC \s!cs        \NC czech        \NC slavic    \NC\MR
664%D \NC \s!sk        \NC slavik       \NC slavic    \NC\LR
665%D \HL
666%D \stoptable
667%D \protect
668%D \unprotect
669%D
670%D \placetable{The altaic languages (\type{lang-alt})}
671%D \starttable[||||]
672%D \HL
673%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
674%D \HL
675%D \NC \s!tr        \NC turkish      \NC altaic    \NC\SR
676%D \HL
677%D \stoptable
678%D
679%D \placetable{The uralic languages (\type{lang-ura})}
680%D \starttable[||||]
681%D \HL
682%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
683%D \HL
684%D \NC \s!fi        \NC finnish      \NC uralic    \NC\SR
685%D \HL
686%D \stoptable
687%D \protect
688
689\unexpanded\def\nopatterns{\normallanguage\minusone}
690
691%D We default to the language belonging to the interface. This is one of the few
692%D places outside the interface modules where \type {\startinterface} is used.
693
694\setupcurrentlanguage[\s!en]
695
696\unexpanded\def\initializemainlanguage
697  {\mainlanguage[\currentlanguage]%
698   \showmessage\m!languages9\currentlanguage}
699
700%D New:
701
702\let\stopexceptions\relax
703
704\unexpanded\def\startexceptions
705  {\dosingleempty\lang_basics_start_exceptions}
706
707\def\lang_basics_start_exceptions[#1]#2\stopexceptions % multilingual or not?
708  {\begingroup
709   \edef\askedlanguage{\reallanguagetag{#1}}%
710   \ifx\askedlanguage\empty
711     \let\askedlanguage\currentlanguage
712   \fi
713   \clf_setlanguageexceptions{\askedlanguage}{#2}%
714   \endgroup}
715
716\unexpanded\def\hyphenation
717  {\clf_setlanguageexceptions{\currentlanguage}}
718
719%D For the moment here:
720
721\uchyph        1 % also treat uppercase
722\exhyphenchar 45 % to permit breaking at explicit hyphens
723
724%D New:
725
726\unexpanded\def\traceddiscretionary#1#%
727  {\dontleavehmode\lang_basics_traced_discretionary{#1}}
728
729\unexpanded\def\lang_basics_traced_discretionary#1#2#3#4%
730  {\normaldiscretionary#1{\darkred#2}{\darkgreen#3}{\darkblue#4}}
731
732\installtextracker
733  {discretionaries}
734  {\let\discretionary\traceddiscretionary}
735  {\let\discretionary\normaldiscretionary}
736
737\unexpanded\def\samplediscretionary
738  {\traceddiscretionary
739     {pre\clf_currentprehyphenchar}%
740     {\clf_currentposthyphenchar post}%
741     {replace}}
742
743\protect \endinput
744