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