summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/lang-tra.mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/lang-tra.mkxl')
-rw-r--r--tex/context/base/mkxl/lang-tra.mkxl42
1 files changed, 34 insertions, 8 deletions
diff --git a/tex/context/base/mkxl/lang-tra.mkxl b/tex/context/base/mkxl/lang-tra.mkxl
index b087832e0..96dcc7d94 100644
--- a/tex/context/base/mkxl/lang-tra.mkxl
+++ b/tex/context/base/mkxl/lang-tra.mkxl
@@ -13,23 +13,49 @@
\writestatus{loading}{ConTeXt Language Macros / Transliteration}
-\registerctxluafile{lang-tra}{}
+\registerctxluafile{lang-tra}{autosuffix}
\unprotect
+\installcorenamespace {transliteration}
+
+\installcommandhandler \??transliteration {transliteration} \??transliteration
+
\definesystemattribute[transliteration][public,global]
-\installcorenamespace {transliteration}
+% define in lua: \usetransliteration[#1]
-\permanent\tolerant\protected\def\definetransliteration[#1]#*[#2]%
- {\clf_definedtransliteration{#1}{#2}}
+% todo: define fast attribute at the tex end do we can have a proper define
-\permanent\protected\def\settransliteration[#1]%
- {\clf_settransliteration{#1}}
+\def\lang_transliteration_set#1%
+ {\ifcsname\??transliteration#1\endcsname
+ \c_attr_transliteration\lastnamedcs
+ \edef\currenttransliteration{#1}%
+ \usetransliterationstyleandcolor\c!style\c!color
+ \uselanguageparameter\transliterationparameter
+ \else
+ \clf_settransliteration{#1}%
+ \fi}
-\permanent\protected\def\starttransliteration[#1]%
+\permanent\tolerant\protected\def\settransliteration[#1]#;#2%
+ {\lang_transliteration_set{#1}}
+
+\permanent\tolerant\protected\def\starttransliteration[#1]#*[#2]%
{\begingroup
- \clf_settransliteration{#1}}
+ \ifparameter#2\or
+ \edef\currenttransliteration{#1}%
+ \setupcurrenttransliteration[#2]%
+ \fi
+ \lang_transliteration_set{#1}}
+
+\permanent\tolerant\protected\def\transliteration[#1]#;#2%
+ {\groupedcommand{\lang_transliteration_set{#1#2}}\donothing}
+
+\appendtoks
+ \expandafter\integerdef\csname\??transliteration\currenttransliteration\endcsname
+ \clf_registertransliteration{\transliterationparameter\c!vector}%
+ \relax
+\to \everydefinetransliteration
\permanent\protected\def\stoptransliteration
{\endgroup}