lang-ini.mkiv /size: 23 Kb    last modification: 2023-12-21 09:44
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   \s!explicitlefthyphenchar=\languageparameter\s!lefthyphenchar,
291   \s!explicitrighthyphenchar=\languageparameter\s!righthyphenchar,
292   % used in compound i.e. interfaced with c! and can be anything so no numbers
293   \c!lefthyphen=,
294   \c!righthyphen=-,
295   \c!hyphen=-,
296   \c!spacing=\v!packed,
297   \c!compoundhyphen=\compoundhyphen,
298   \c!rightcompoundhyphen=\compoundhyphen,
299   \c!leftcompoundhyphen=,
300   \c!midsentence=---,
301   \c!leftsentence=---,
302   \c!rightsentence=---,
303   \c!leftsubsentence=---,
304   \c!rightsubsentence=---,
305   \c!leftquote=\upperleftsinglesixquote,
306   \c!rightquote=\upperrightsingleninequote,
307   \c!leftquotation=\upperleftdoublesixquote,
308   \c!rightquotation=\upperrightdoubleninequote,
309   \c!leftspeech=\languageparameter\c!leftquotation,
310   \c!middlespeech=,
311   \c!rightspeech=\languageparameter\c!rightquotation,
312   \c!limittext=\unknown,
313   \c!time={h,:,m},
314   \c!date={\v!year,\ ,\v!month,\ ,\v!day},
315   \c!text=Ag,
316   \c!font=] % \v!auto : experimental !
317
318% to be tested:
319%
320% \setuplanguage
321%   [\s!default]
322%   [\c!righthyphenchar="AD]
323
324%D The values \type {leftsentence} and \type {rightsentence} can be (and are) used
325%D to implement automatic subsentence boundary glyphs, like in {\fr |<|french
326%D guillemots|>|} or {\de |<|german guillemots|>|} or {\nl |<|dutch dashes|>|} like
327%D situations. Furthermore \type {leftquotation} and \type {leftquote} come into
328%D view \quotation {when we quote} or \quote {quote} something.
329
330%D \macros
331%D  {currentdatespecification, currenttimespecification}
332%D
333%D Just to make things easy we can ask for the current date specification by saying:
334
335\def\currentdatespecification{\languageparameter\c!date}
336\def\currenttimespecification{\languageparameter\c!time}
337
338%D Carefull reading of these macros shows that it's legal to say
339%D
340%D \starttyping
341%D \installlanguage [du] [de]
342%D \stoptyping
343
344%D \macros
345%D   {language,mainlanguage}
346%D
347%D Switching to another language (actually another hyphenation pattern) is done
348%D with:
349%D
350%D \starttyping
351%D \language[identifier]
352%D \stoptyping
353%D
354%D or with \type {\identifier}. Just to be compatible with \PLAIN\ \TEX, we still
355%D support the original meaning, so
356%D
357%D \starttyping
358%D \language=1
359%D \stoptyping
360%D
361%D is a valid operation, where the relation between number and language depends on
362%D the order in installing languages.
363%D
364%D \showsetup{language}
365%D \showsetup{mainlanguage}
366%D
367%D Both commands take a predefined language identifier as argument. We can use \type
368%D {\mainlanguage[identifier]} for setting the (indeed) main language. This is the
369%D language used for translating labels like {\em figure} and {\em table}. The main
370%D language defaults to the current language.
371
372\newtoks \everylanguage
373
374\installcorenamespace{languagenumbers}
375
376\appendtoks
377    % we need to reassign the number because new patterns can be defined later on
378    % so let's hope not that many \setups happen during a run
379    \expandafter\glet\csname\??languagenumbers\currentlanguage\endcsname\undefined
380\to \everysetuplanguage
381
382\def\lang_basics_synchronize_yes
383  {\zerocount % see below
384   \global\expandafter\chardef\csname\??languagenumbers\currentlanguage\endcsname
385      \clf_languagenumber
386        {\currentlanguage}%
387        {\defaultlanguage\currentlanguage}%
388        {\languageparameter\s!patterns}%
389        {\languageparameter\c!factor}%
390      \relax
391   \normallanguage\csname\??languagenumbers\currentlanguage\endcsname}
392
393\let\lang_basics_synchronize_nop\zerocount % not loaded anyway
394
395\letvalue{\??languagenumbers}\lang_basics_synchronize_nop % initime
396
397\appendtoks
398    \letvalue{\??languagenumbers}\lang_basics_synchronize_yes % runtime
399\to \everydump
400
401\def\lang_basics_synchronize
402  {\normallanguage\csname\??languagenumbers
403     \ifcsname\??languagenumbers\currentlanguage\endcsname
404       \currentlanguage
405     \fi
406   \endcsname
407   \relax
408   \the\everylanguage
409   \relax}
410
411\newcount\hyphenstate
412\newcount\hyphenminoffset
413
414\unexpanded\def\lesshyphens
415  {\advance\hyphenminoffset\plusone
416   \lang_basics_synchronize_min_max}
417
418\unexpanded\def\morehyphens
419  {\ifcase\hyphenminoffset \else
420     \advance\hyphenminoffset\minusone
421   \fi
422   \lang_basics_synchronize_min_max}
423
424\unexpanded\def\nohyphens % nicer for url's
425  {\ifx\dohyphens\relax
426     \unexpanded\edef\dohyphens
427       {\hyphenminoffset\the\hyphenminoffset\relax
428        \lang_basics_synchronize_min_max}%
429   \fi
430   \hyphenminoffset\plusthousand
431   \lang_basics_synchronize_min_max}
432
433\let\dohyphens\relax
434
435\unexpanded\def\usehyphensparameter#1%
436  {\edef\p_hyphens{#1\c!hyphens}%
437   \ifx\p_hyhens\v!no
438     \nohyphens
439   \fi}
440
441\unexpanded\def\lang_basics_synchronize_min_max % maybe store this at the lua end
442  {% these values are stored along with glyph nodes
443   \lefthyphenmin \numexpr0\languageparameter\s!lefthyphenmin +\hyphenminoffset\relax
444   \righthyphenmin\numexpr0\languageparameter\s!righthyphenmin+\hyphenminoffset\relax
445   \hyphenationmin\numexpr0\languageparameter\s!hyphenmin\relax
446   % these values are stored with the language (global!)
447   \prehyphenchar   \languageparameter\s!righthyphenchar\relax
448   \posthyphenchar  \languageparameter\s!lefthyphenchar \relax
449   \preexhyphenchar \languageparameter\s!explicitrighthyphenchar\relax
450   \postexhyphenchar\languageparameter\s!explicitlefthyphenchar \relax}
451
452\appendtoks
453    \lang_basics_synchronize_min_max
454\to \everylanguage
455
456\unexpanded\def\unhyphenated
457  {\groupedcommand{\lefthyphenmin\maxdimen}\donothing}
458
459% \appendtoks
460%     \setups[\languageparameter\c!setups]%
461% \to \everylanguage
462
463%D You can setup the default language to reset settings.
464
465\appendtoks
466    \edef\currentlanguagesetups{\languageparameter\c!setups}%
467    \ifx\currentlanguagesetups\empty \else
468        \setups[\currentlanguagesetups]%
469    \fi
470\to \everylanguage
471
472% new
473
474\appendtoks
475    \usebidiparameter\languageparameter
476\to \everylanguage
477
478% this will move to core-spa !
479
480\appendtoks
481    \edef\p_spacing{\languageparameter\c!spacing}%
482    \ifx\p_spacing\v!broad
483      \nonfrenchspacing
484    \else
485      \frenchspacing
486    \fi
487\to \everylanguage
488
489% \mainlanguage[nl] \setuplanguage[nl][lefthyphen=,righthyphen=?]
490%
491% \dorecurse{100}{dit is toch wel een heel\normalhyphendiscretionary lang\normalhyphendiscretionary woord \recurselevel\ }
492% \dorecurse{100}{dit is toch wel een heellangwoord \recurselevel\ }
493
494% new experimental feature
495
496\unexpanded\def\setuplanguages
497  {\setuplanguage[\s!default]}
498
499% \setuplanguages[\c!font=\v!auto]
500% \setuplanguage[\s!default][\c!font=\v!auto]
501% \setuplanguage[nl][\c!font=\v!auto]
502
503\appendtoks
504    \edef\p_language_font{\languageparameter\c!font}%
505    \ifx\p_language_font\empty\else
506      \ifx\p_language_font\v!auto
507        \doaddfeature\currentlanguage
508      \else
509        \doaddfeature\p_language_font
510      \fi
511    \fi
512\to \everylanguage
513
514%D Fast switcher
515
516\def\lang_basics_switch_asked
517  {\ifcsname\??languagelinked\askedlanguage\endcsname
518     \edef\askedlanguage{\lastnamedcs}%
519     \ifx\currentlanguage\askedlanguage \else
520       \setcurrentlanguage\currentmainlanguage\askedlanguage
521       \lang_basics_synchronize
522     \fi
523   \fi}
524
525\unexpanded\def\uselanguageparameter#1%
526  {\edef\askedlanguage{#1\c!language}%
527   \ifx\askedlanguage\empty\else\lang_basics_switch_asked\fi}
528
529\unexpanded\def\douselanguageparameter#1% fast setter
530  {\edef\askedlanguage{#1}%
531   \ifx\askedlanguage\empty\else\lang_basics_switch_asked\fi}
532
533\unexpanded\def\lang_basics_set_current[#1]%
534  {\edef\askedlanguage{#1}%
535   \ifx\askedlanguage\empty\else\lang_basics_switch_asked\fi}
536
537\unexpanded\def\language
538  {\doifelsenextoptionalcs\lang_basics_set_current\normallanguage}
539
540\let\setlanguage\language % we make these synonyms
541
542\let\patterns\gobbleoneargument
543
544\newcount\mainlanguagenumber
545
546%D Beware: you might need to use \type {\dontleavehmode} outside and|/|or \type {\par}
547%D inside the group!
548
549\unexpanded\def\startlanguage
550  {\begingroup\language}
551
552\let\stoplanguage\endgroup
553
554\unexpanded\def\mainlanguage[#1]%
555  {\edef\askedlanguage{#1}%
556   \ifx\askedlanguage\empty \else
557     \ifcsname\??languagelinked\askedlanguage\endcsname
558      %\edef\askedlanguage{\csname\??languagelinked\askedlanguage\endcsname}%
559       \edef\askedlanguage{\lastnamedcs}%
560       \ifx\currentlanguage\askedlanguage
561         \ifx\currentmainlanguage\askedlanguage \else
562           \setcurrentlanguage\askedlanguage\askedlanguage
563           \lang_basics_synchronize
564         \fi
565       \else
566         \setcurrentlanguage\askedlanguage\askedlanguage
567         \lang_basics_synchronize
568       \fi
569     \fi
570   \fi
571   \mainlanguagenumber\normallanguage}
572
573\appendtoks
574    \normallanguage\mainlanguagenumber
575\to \everybeforepagebody
576
577%D Used at all?
578
579\def\splitsequence#1#2%
580  {\doifelse{#1}\v!no{#2}{\doifelse{#1}\v!yes{\languageparameter\c!limittext}{#1}}}
581
582\def\splitsymbol#1%
583  {\splitsequence{#1}{\languageparameter\c!limittext}}
584
585%D Just like with subsentence boundary symbols, quotes placement depends on the
586%D current language, therefore we show the defaults here.
587%D
588%D \def\ShowLanguageValues [#1] [#2] #3 #4
589%D   {\blank
590%D    \startlinecorrection
591%D    \vbox\bgroup
592%D    \language[#1]
593%D    \midaligned{\bf#2 subsentence symbol and quotes}
594%D    \framed[width=\hsize,frame=off,topframe=on,bottomframe=on,offset=.5ex]
595%D      {\hfil\quotation{#3 #4}\hfil\quote{#2}\hfil
596%D       \startsubsentence\startsubsentence#3\stopsubsentence#4\stopsubsentence\hfil}
597%D    \egroup
598%D    \stoplinecorrection
599%D    \blank}
600%D
601%D \ShowLanguageValues [af] [afrikaans]  afrikaanse ...
602%D \ShowLanguageValues [ca] [catalan]    catalan ...
603%D \ShowLanguageValues [cs] [czech]      tjechisch tex
604%D \ShowLanguageValues [cs] [slovak]     slowaakse ...
605%D \ShowLanguageValues [da] [danish]     deense ...
606%D \ShowLanguageValues [de] [german]     duitse degelijkheid
607%D \ShowLanguageValues [en] [english]    engelse humor
608%D \ShowLanguageValues [et] [estonian]   ...
609%D \ShowLanguageValues [fi] [finnish]    finse ...
610%D \ShowLanguageValues [fr] [french]     franse slag
611%D \ShowLanguageValues [it] [italian]    italiaanse ...
612%D \ShowLanguageValues [la] [latin]      latijnse missen
613%D \ShowLanguageValues [nl] [dutch]      nederlandse zuinigheid
614%D \ShowLanguageValues [nb] [bokmal]     noorse zalm
615%D \ShowLanguageValues [nn] [nnynorsk]   noorse zalm
616%D \ShowLanguageValues [pl] [polish]     poolse vlag
617%D \ShowLanguageValues [pt] [portuguese] portugese ...
618%D \ShowLanguageValues [es] [spanish]    spaans benauwd
619%D \ShowLanguageValues [sv] [swedish]    zweedse ...
620%D \ShowLanguageValues [tr] [turkish]    turks fruit
621
622%D We support a lot of languages. These are specified and loaded in separate files,
623%D according to their roots. Here we only take care of (postponed) setting of the
624%D current language.
625%D
626%D \unprotect
627%D \placetable{The germanic languages (\type{lang-ger})}
628%D \starttable[||||]
629%D \HL
630%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
631%D \HL
632%D \NC \s!nl        \NC dutch        \NC germanic  \NC\FR
633%D \NC \s!en        \NC english      \NC germanic  \NC\MR
634%D \NC \s!de        \NC german       \NC germanic  \NC\MR
635%D \NC \s!da        \NC danish       \NC germanic  \NC\MR
636%D \NC \s!sv        \NC swedish      \NC germanic  \NC\MR
637%D \NC \s!af        \NC afrikaans    \NC germanic  \NC\MR
638%D \NC \s!nb        \NC bokmal       \NC germanic  \NC\LR
639%D \NC \s!nn        \NC nynorsk      \NC germanic  \NC\LR
640%D \HL
641%D \stoptable
642%D \protect
643%D
644%D \unprotect
645%D \placetable{The italic languages (\type{lang-ita})}
646%D \starttable[||||]
647%D \HL
648%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
649%D \HL
650%D \NC \s!fr        \NC french       \NC italic    \NC\FR
651%D \NC \s!ca        \NC catalan      \NC italic    \NC\MR
652%D \NC \s!es        \NC spanish      \NC italic    \NC\MR
653%D \NC \s!it        \NC italian      \NC italic    \NC\MR
654%D \NC \s!la        \NC latin        \NC italic    \NC\MR
655%D \NC \s!pt        \NC portuguese   \NC italic    \NC\LR
656%D \HL
657%D \stoptable
658%D \protect
659%D
660%D \unprotect
661%D \placetable{The slavic languages (\type{lang-sla})}
662%D \starttable[||||]
663%D \HL
664%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
665%D \HL
666%D \NC \s!pl        \NC polish       \NC slavic    \NC\FR
667%D \NC \s!cs        \NC czech        \NC slavic    \NC\MR
668%D \NC \s!sk        \NC slavik       \NC slavic    \NC\LR
669%D \HL
670%D \stoptable
671%D \protect
672%D \unprotect
673%D
674%D \placetable{The altaic languages (\type{lang-alt})}
675%D \starttable[||||]
676%D \HL
677%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
678%D \HL
679%D \NC \s!tr        \NC turkish      \NC altaic    \NC\SR
680%D \HL
681%D \stoptable
682%D
683%D \placetable{The uralic languages (\type{lang-ura})}
684%D \starttable[||||]
685%D \HL
686%D \NC \bf mnemonic \NC \bf language \NC \bf group \NC\SR
687%D \HL
688%D \NC \s!fi        \NC finnish      \NC uralic    \NC\SR
689%D \HL
690%D \stoptable
691%D \protect
692
693\unexpanded\def\nopatterns{\normallanguage\minusone}
694
695%D We default to the language belonging to the interface. This is one of the few
696%D places outside the interface modules where \type {\startinterface} is used.
697
698\setupcurrentlanguage[\s!en]
699
700\unexpanded\def\initializemainlanguage
701  {\mainlanguage[\currentlanguage]%
702   \showmessage\m!languages9\currentlanguage}
703
704%D New:
705
706\let\stopexceptions\relax
707
708\unexpanded\def\startexceptions
709  {\dosingleempty\lang_basics_start_exceptions}
710
711\def\lang_basics_start_exceptions[#1]#2\stopexceptions % multilingual or not?
712  {\begingroup
713   \edef\askedlanguage{\reallanguagetag{#1}}%
714   \ifx\askedlanguage\empty
715     \let\askedlanguage\currentlanguage
716   \fi
717   \clf_setlanguageexceptions{\askedlanguage}{#2}%
718   \endgroup}
719
720\unexpanded\def\hyphenation
721  {\clf_setlanguageexceptions{\currentlanguage}}
722
723%D For the moment here:
724
725\uchyph        1 % also treat uppercase
726\exhyphenchar 45 % to permit breaking at explicit hyphens
727
728%D New:
729
730\unexpanded\def\traceddiscretionary#1#%
731  {\dontleavehmode\lang_basics_traced_discretionary{#1}}
732
733\unexpanded\def\lang_basics_traced_discretionary#1#2#3#4%
734  {\normaldiscretionary#1{\darkred#2}{\darkgreen#3}{\darkblue#4}}
735
736\installtextracker
737  {discretionaries}
738  {\let\discretionary\traceddiscretionary}
739  {\let\discretionary\normaldiscretionary}
740
741\unexpanded\def\samplediscretionary
742  {\traceddiscretionary
743     {pre\clf_currentprehyphenchar}%
744     {\clf_currentposthyphenchar post}%
745     {replace}}
746
747\protect \endinput
748