diff options
author | Norbert Preining <preining@logic.at> | 2019-02-24 15:12:57 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2019-02-24 15:12:57 +0000 |
commit | 1314fbe93790c501dc436a5cf99f106b9e5c0f63 (patch) | |
tree | 04dc7734c8be8ffe385d41f4388826ef5857b6f9 /Master/texmf-dist/tex/context/base/mkiv/lang-ini.mkiv | |
parent | eb80ce7b34f59896a1dfee5ca422495394d6677f (diff) |
Revert "ConTeXt version 2019.02.22 19:35"
This reverts commit 5c6357cdb820b4f628d036ba7b2248f221d50c0b.
git-svn-id: svn://tug.org/texlive/trunk@50112 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/lang-ini.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/lang-ini.mkiv | 270 |
1 files changed, 189 insertions, 81 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-ini.mkiv b/Master/texmf-dist/tex/context/base/mkiv/lang-ini.mkiv index 296cf7f1c86..7c83ae38fb8 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lang-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/lang-ini.mkiv @@ -15,10 +15,10 @@ % \cldcontext{languages.numbers[tex.count.mainlanguagenumber]} -%D This module implements multi||language support of \CONTEXT, which should not be -%D confused with the multi||lingual interface. This support will be extended when -%D needed. Properties of languages are defined in \TEX\ files as well as \LUA\ -%D files. +%D This module implements the (for the moment still simple) +%D multi||language support of \CONTEXT, which should not be +%D confused with the multi||lingual interface. This support +%D will be extended when needed. \writestatus{loading}{ConTeXt Language Macros / Initialization} @@ -28,27 +28,41 @@ \unprotect +% \def\testlanguage[#1]% +% {\start +% \language[#1] +% \number\normallanguage/\the\lefthyphenmin/\the\righthyphenmin: +% \input tufte +% \hyphenatedword{effetestenofditwerkt} +% \par +% \stop} +% +% \testlanguage[de] \testlanguage[de-de] \testlanguage[de-at] \testlanguage[de-ch] \page +% \testlanguage[en] \testlanguage[us] \testlanguage[en-us] \testlanguage[uk] \testlanguage[en-gb] \page + \ifdefined\nonfrenchspacing\else \let\nonfrenchspacing\relax \fi \ifdefined\frenchspacing \else \let\frenchspacing \relax \fi -%D When loading hyphenation patterns, \TEX\ assign a number to each loaded table, -%D starting with~0. Switching to a specific table is done by assigning the relevant -%D number to the predefined \COUNTER\ \type {\language}. However, in \MKIV\ a lot -%D of management is delegated to \LUA. +%D When loading hyphenation patterns, \TEX\ assign a number to +%D each loaded table, starting with~0. Switching to a specific +%D table is done by assigning the relevant number to the +%D predefined \COUNTER\ \type{\language}. -%D We keep track of the last loaded patterns by means of a pseudo \COUNTER. This -%D just one of those situations in which we don't want to spent a real one. Language -%D zero has no patterns, first of all because I like to start numbering at one. It -%D may come in handy for special purposes as well. +%D We keep track of the last loaded patterns by means of a +%D pseudo \COUNTER. This just one of those situations in which +%D we don't want to spent a real one. Language zero has no +%D patterns, first of all because I like to start numbering +%D at one. It may come in handy for special purposes as well. \normallanguage\zerocount \def\loadedlanguage{1} %D \macros %D {currentlanguage, setupcurrentlanguage} %D -%D Instead of numbers,we are going to use symbolic names for the languages. The -%D current langage is saved in the macro \type {\currentlanguage}. The setup macro -%D is mainly used for cosmetic purposes. +%D Instead of numbers,we are going to use symbolic names for +%D the languages. The current langage is saved in the macro +%D \type {\currentlanguage}. The setup macro is mainly used +%D for cosmetic purposes. %D %D \starttyping %D \dorecurse{3} @@ -65,9 +79,10 @@ %D \macros %D {defaultlanguage,languageparameter,specificlanguageparameter} -%D -%D We don't use the commandhandler here (yet) because we have a rather special -%D fallback mechanism so quite some compatibility testing is needed. + +%D We don't use the commandhandler here (yet) because we have +%D a rather special fallback mechanism so quite some compatibility +%D testing is needed. \installcorenamespace{language} \installcorenamespace{languagelinked} @@ -81,6 +96,33 @@ #1% \fi} +% \def\languageparameter#1% +% {\ifcsname\??language\currentlanguage#1\endcsname +% \csname\??language\currentlanguage#1\endcsname +% \else\ifcsname\??language\currentlanguage\s!default\endcsname +% \expandafter\specificlanguageparameter\csname\??language\currentlanguage\s!default\endcsname{#1}% +% \else\ifcsname\??language\s!default#1\endcsname +% \csname\??language\s!default#1\endcsname +% \fi\fi\fi} +% +% \def\specificlanguageparameter#1#2% +% {\ifcsname\??language#1#2\endcsname +% \csname\??language#1#2\endcsname +% \else\ifcsname\??language#1\s!default\endcsname +% \expandafter\specificlanguageparameter\csname\??language#1\s!default\endcsname{#2}% +% \else\ifcsname\??language\s!default#2\endcsname +% \csname\??language\s!default#2\endcsname +% \fi\fi\fi} +% +% \def\mainlanguageparameter#1% +% {\ifcsname\??language\currentmainlanguage#1\endcsname +% \csname\??language\currentmainlanguage#1\endcsname +% \else\ifcsname\??language\currentmainlanguage\s!default\endcsname +% \expandafter\specificlanguageparameter\csname\??language\currentmainlanguage\s!default\endcsname{#1}% +% \else\ifcsname\??language\s!default#1\endcsname +% \csname\??language\s!default#1\endcsname +% \fi\fi\fi} + \def\languageparameter#1% {\ifcsname\??language\currentlanguage#1\endcsname \lastnamedcs @@ -110,6 +152,15 @@ \let\usedlanguageparameter\languageparameter +% \def\askedlanguageparameter#1% assumes \currentusedlanguage being set +% {\ifcsname\??language\currentusedlanguage#1\endcsname +% \csname\??language\currentusedlanguage#1\endcsname +% \else\ifcsname\??language\currentusedlanguage\s!default\endcsname +% \expandafter\specificlanguageparameter\csname\??language\currentusedlanguage\s!default\endcsname{#1}% +% \else\ifcsname\??language\s!default#1\endcsname +% \csname\??language\s!default#1\endcsname +% \fi\fi\fi} + \def\askedlanguageparameter#1% assumes \currentusedlanguage being set {\ifcsname\??language\currentusedlanguage#1\endcsname \lastnamedcs @@ -120,6 +171,7 @@ \fi\fi\fi} \unexpanded\def\setusedlanguage#1% +% {\edef\currentusedlanguage{\reallanguagetag{#1\c!language}}% {\edef\currentusedlanguage{\reallanguagetag{#1}}% \ifx\currentusedlanguage\empty \let\currentusedlanguage \currentlanguage @@ -156,23 +208,43 @@ %D \macros %D {installlanguage} %D -%D Hyphenation patterns can only be loaded when the format file is prepared. The -%D next macro takes care of this loading. A language is specified with +%D Hyphenation patterns can only be loaded when the format file +%D is prepared. The next macro takes care of this loading. A +%D language is specified with %D %D \showsetup{installlanguage} %D -%D When \type {state} equals \type {start}, both patterns and additional hyphenation -%D specifications are loaded. These files are seached for in the patterns path -%D have names like \type {lang-nl.lua}. +%D When \type {state} equals \type {start}, both patterns +%D and additional hyphenation specifications are loaded. These +%D files are seached for on the system path and are to be +%D named: +%D +%D \starttyping +%D lang-identifier.\f!patternsextension +%D lang-identifier.\f!hyhensextension +%D \stoptyping %D -%D The \type {spacing} variable specifies how the spaces after punctuation has to be -%D handled. English is by tradition more tolerant to inter||sentence spacing than -%D other languages. +%D The \type{spacing} variable specifies how the spaces after +%D punctuation has to be handled. English is by tradition more +%D tolerant to inter||sentence spacing than other languages. +%D +%D This macro also defines \type {\identifier} as a shortcut +%D switch to the language. Furthermore the command defined as +%D being language specific, are executed. With +%D \type {default} we can default to another language +%D (patterns) at format generation time. This default language +%D is overruled when the appropriate patterns are loaded (some +%D implementations support run time addition of patterns to a +%D preloaded format). + +%D \macros +%D {preloadlanguages} %D -%D This macro also defines \type {\identifier} as a shortcut switch to the language. -%D Furthermore the command defined as being language specific, are executed. With -%D \type {default} we can default to another language (patterns) at format -%D generation time. Patterns are loaded at runtime. +%D We first try to load the files defined as file synonym +%D for \type {lang-*.pat} and \type {lang-*.hyp}. After that we +%D fall back on those files. The macro \type {\preloadpatterns} +%D reports which patterns are loaded and what hyphenmin +%D values are set. \newtoks \everysetuplanguage @@ -188,6 +260,7 @@ \let\doiflanguageelse\doifelselanguage \def\reallanguagetag#1% + %{\ifcsname\??languagelinked#1\endcsname\csname\??languagelinked#1\endcsname\else#1\fi} {\ifcsname\??languagelinked#1\endcsname\lastnamedcs\else#1\fi} % \language[#1] gave unwanted side effect of loading language specifics @@ -212,9 +285,10 @@ \def\lang_basics_install_indeed#1#2% {\ifcsname#1\endcsname\else\setuvalue{#1}{\lang_basics_set_current[#2]}\fi} -%D When the second argument is a language identifier, a synonym is created. This -%D feature is present because we used dutch mnemonics in the dutch version, but -%D nowadays conform a standard. +%D When the second argument is a language identifier, a +%D synonym is created. This feature is present because we +%D used dutch mnemonics in the dutch version, but nowadays +%D conform a standard. \unexpanded\def\doifelsepatterns#1% {\begingroup % will change @@ -243,15 +317,13 @@ \let\lang_basics_synchronize\relax % be nice for setups till we have one \fi -\installmacrostack\currentlanguage - \def\lang_basics_setup[#1][#2]% {\ifsecondargument - \push_macro_currentlanguage % can be default + \pushmacro\currentlanguage % can be default \edef\currentsetuplanguage{\reallanguagetag{#1}}% \getparameters[\??language\currentsetuplanguage][#2]% \the\everysetuplanguage - \pop_macro_currentlanguage + \popmacro\currentlanguage %\doif\currentsetuplanguage\currentlanguage we can have influenced inheritance (default) \else \let\currentsetuplanguage\currentlanguage @@ -292,7 +364,6 @@ \c!middlespeech=, \c!rightspeech=\languageparameter\c!rightquotation, \c!limittext=\unknown, - \c!time={h,:,m}, \c!date={\v!year,\ ,\v!month,\ ,\v!day}, \c!text=Ag, \s!font=] % \v!auto : experimental ! @@ -303,21 +374,26 @@ % [\s!default] % [\c!righthyphenchar="AD] -%D The values \type {leftsentence} and \type {rightsentence} can be (and are) used -%D to implement automatic subsentence boundary glyphs, like in {\fr |<|french -%D guillemots|>|} or {\de |<|german guillemots|>|} or {\nl |<|dutch dashes|>|} like -%D situations. Furthermore \type {leftquotation} and \type {leftquote} come into -%D view \quotation {when we quote} or \quote {quote} something. +%D The values \type {leftsentence} and \type +%D {rightsentence} can be (and are) used to implement +%D automatic subsentence boundary glyphs, like in {\fr +%D |<|french guillemots|>|} or {\de |<|german guillemots|>|} or +%D {\nl |<|dutch dashes|>|} like situations. Furthermore \type +%D {leftquotation} and \type {leftquote} come into view +%D \quotation {when we quote} or \quote {quote} something. %D \macros -%D {currentdatespecification, currenttimespecification} +%D {currentdatespecification} %D -%D Just to make things easy we can ask for the current date specification by saying: +%D Just to make things easy we can ask for the current date +%D specification by saying: \def\currentdatespecification{\languageparameter\c!date} -\def\currenttimespecification{\languageparameter\c!time} -%D Carefull reading of these macros shows that it's legal to say +%D This command is not meant for users. + +%D Carefull reading of these macros shows that it's legal to +%D say %D %D \starttyping %D \installlanguage [du] [de] @@ -326,39 +402,54 @@ %D \macros %D {language,mainlanguage} %D -%D Switching to another language (actually another hyphenation pattern) is done -%D with: +%D Switching to another language (actually another hyphenation +%D pattern) is done with: %D %D \starttyping %D \language[identifier] %D \stoptyping %D -%D or with \type {\identifier}. Just to be compatible with \PLAIN\ \TEX, we still -%D support the original meaning, so +%D or with \type{\identifier}. Just to be compatible with +%D \PLAIN\ \TEX, we still support the original meaning, so %D %D \starttyping %D \language=1 %D \stoptyping %D -%D is a valid operation, where the relation between number and language depends on -%D the order in installing languages. +%D is a valid operation, where the relation between number +%D and language depends on the order in installing languages. %D %D \showsetup{language} %D \showsetup{mainlanguage} %D -%D Both commands take a predefined language identifier as argument. We can use \type -%D {\mainlanguage[identifier]} for setting the (indeed) main language. This is the -%D language used for translating labels like {\em figure} and {\em table}. The main -%D language defaults to the current language. +%D Both commands take a predefined language identifier as +%D argument. We can use \type{\mainlanguage[identifier]} for +%D setting the (indeed) main language. This is the language +%D used for translating labels like {\em figure} and {\em +%D table}. The main language defaults to the current language. +%D +%D We take care of local as well as standardized language +%D switching (fr and fa, de and du, but nl and nl). \newtoks \everylanguage +% \def\lang_basics_synchronize% assumes that \currentlanguage is set % % % use different name as complex +% {\normallanguage\ctxcommand{languagenumber(% +% "\currentlanguage",% +% "\defaultlanguage\currentlanguage",% +% "\languageparameter\s!patterns"% +% )}\relax +% \the\everylanguage\relax} + +% (some 20%) faster but code jungle (the publication code can have excessive +% switching + \installcorenamespace{languagenumbers} \appendtoks % we need to reassign the number because new patterns can be defined later on % so let's hope not that many \setups happen during a run - \expandafter\glet\csname\??languagenumbers\currentlanguage\endcsname\undefined + \global\expandafter\let\csname\??languagenumbers\currentlanguage\endcsname\undefined \to \everysetuplanguage \def\lang_basics_synchronize_yes @@ -380,7 +471,7 @@ \letvalue{\??languagenumbers}\lang_basics_synchronize_yes % runtime \to \everydump -\def\lang_basics_synchronize +\def\lang_basics_synchronize% assumes that \currentlanguage is set % % % use different name as complex {\normallanguage\csname\??languagenumbers \ifcsname\??languagenumbers\currentlanguage\endcsname \currentlanguage @@ -390,7 +481,12 @@ \the\everylanguage \relax} +% experimental + \newcount\hyphenstate + +% so far + \newcount\hyphenminoffset \unexpanded\def\lesshyphens @@ -434,7 +530,7 @@ % \setups[\languageparameter\c!setups]% % \to \everylanguage -%D You can setup the default language to reset settings. +%D You can setup the 'default' language to reset settings. \appendtoks \edef\currentlanguagesetups{\languageparameter\c!setups}% @@ -452,12 +548,7 @@ % this will move to core-spa ! \appendtoks - \edef\p_spacing{\languageparameter\c!spacing}% - \ifx\p_spacing\v!broad - \nonfrenchspacing - \else - \frenchspacing - \fi + \doifelse{\languageparameter\c!spacing}\v!broad\nonfrenchspacing\frenchspacing \to \everylanguage % \mainlanguage[nl] \setuplanguage[nl][lefthyphen=,righthyphen=?] @@ -485,6 +576,11 @@ \fi \to \everylanguage +% The following may be a solution for the fact that one cannot +% change catcodes of characters like : and ; inside an environment. + +% we will also permit access by the other names + %D Fast switcher \def\lang_basics_switch_asked @@ -517,13 +613,23 @@ \newcount\mainlanguagenumber -%D Beware: you might need to use \type {\dontleavehmode} outside and|/|or \type {\par} -%D inside the group! - -\unexpanded\def\startlanguage - {\begingroup\language} - -\let\stoplanguage\endgroup +% \unexpanded\def\mainlanguage[#1]% +% {\edef\askedlanguage{#1}% +% \ifx\askedlanguage\empty \else +% \ifcsname\??languagelinked\askedlanguage\endcsname +% \edef\askedlanguage{\csname\??languagelinked\askedlanguage\endcsname}% +% \ifx\currentlanguage\askedlanguage +% \ifx\currentmainlanguage\askedlanguage \else +% \setcurrentlanguage\askedlanguage\askedlanguage +% \lang_basics_synchronize +% \fi +% \else +% \setcurrentlanguage\askedlanguage\askedlanguage +% \lang_basics_synchronize +% \fi +% \fi +% \fi +% \mainlanguagenumber\normallanguage} \unexpanded\def\mainlanguage[#1]% {\edef\askedlanguage{#1}% @@ -556,8 +662,9 @@ \def\splitsymbol#1% {\splitsequence{#1}{\languageparameter\c!limittext}} -%D Just like with subsentence boundary symbols, quotes placement depends on the -%D current language, therefore we show the defaults here. +%D Just like with subsentence boundary symbols, quotes +%D placement depends on the current language, therefore we show +%D the defaults here. %D %D \def\ShowLanguageValues [#1] [#2] #3 #4 %D {\blank @@ -579,7 +686,6 @@ %D \ShowLanguageValues [da] [danish] deense ... %D \ShowLanguageValues [de] [german] duitse degelijkheid %D \ShowLanguageValues [en] [english] engelse humor -%D \ShowLanguageValues [et] [estonian] ... %D \ShowLanguageValues [fi] [finnish] finse ... %D \ShowLanguageValues [fr] [french] franse slag %D \ShowLanguageValues [it] [italian] italiaanse ... @@ -593,9 +699,10 @@ %D \ShowLanguageValues [sv] [swedish] zweedse ... %D \ShowLanguageValues [tr] [turkish] turks fruit -%D We support a lot of languages. These are specified and loaded in separate files, -%D according to their roots. Here we only take care of (postponed) setting of the -%D current language. +%D We support a lot of languages. These are specified and +%D loaded in separate files, according to their roots. Here +%D we only take care of (postponed) setting of the current +%D language. %D %D \unprotect %D \placetable{The germanic languages (\type{lang-ger})} @@ -666,8 +773,9 @@ \unexpanded\def\nopatterns{\normallanguage\minusone} -%D We default to the language belonging to the interface. This is one of the few -%D places outside the interface modules where \type {\startinterface} is used. +%D We default to the language belonging to the interface. This +%D is one of the few places outside the interface modules where +%D \type{\startinterface} is used. \setupcurrentlanguage[\s!en] |