summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/base/languages.opm
blob: aedcd249f43230fceaf8245e87f6ec30e04fbccb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
%% This is part of OpTeX project, see http://petr.olsak.net/optex

\_codedecl \_mtext {Languages <2020-04-29>} % preloaded in format 

   \_doc -----------------------------
   Only four words are generated by \OpTeX/ macros: \"Chapter",
   \"Table", \"Figure" and \"Subject". These phrases can be generated depending 
   on the current value of `\language` register, if you use \`\_mtext``{<phrase-id>}`, 
   specially `\_mtext{chap}`, `\_mtext{t}`, `\_mtext{f}` or `\_mtext{subj}`. 
   If your macros generate more words then 
   you can define such words by `\sdef{_mt:<phrase-id>:<lang>}` where
   `<phrase-id>` is a label for declared word and `<lang>` is language shortcut
   (iso code). 
   \_cod -----------------------------

\_def\_mtext#1{\_trycs{_mt:#1:\_trycs{_lan:\_the\_language}{en}}
   {\_csname _mt:#1:en\_endcsname}}

\_sdef{_mt:chap:en}{Chapter} \_sdef{_mt:chap:cs}{Kapitola} \_sdef{_mt:chap:sk}{Kapitola}
\_sdef{_mt:t:en}{Table}      \_sdef{_mt:t:cs}{Tabulka}     \_sdef{_mt:t:sk}{Tabuľka}
\_sdef{_mt:f:en}{Figure}     \_sdef{_mt:f:cs}{Obrázek}     \_sdef{_mt:f:sk}{Obrázok}
\_sdef{_mt:subj:en}{Subject} \_sdef{_mt:subj:cs}{Věc}      \_sdef{_mt:subj:sk}{Vec}

   \_doc -----------------------------
   Using \`\_langw` `<lang> <chapter> <table> <figure> <subject>` you can
   declare these words more effectively: 
   \maxlines=13
   \_cod -----------------------------

\_def \_langw #1 #2 #3 #4 #5 {%
   \_sdef{_mt:chap:#1}{#2}\_sdef{_mt:t:#1}{#3}\_sdef{_mt:f:#1}{#4}%
   \_sdef{_mt:subj:#1}{#5}%
}

\_langw en  Chapter      Table       Figure       Subject
%--------------------------------------------------------------
\_langw cs  Kapitola     Tabulka     Obrázek      Věc
\_langw de  Kapitel      Tabelle     Abbildung    Subjekt
\_langw es  Capítulo     Tabla       Figura       Sujeto
\_langw fr  Chaptire     Tableau     Figure       Matière
\_langw it  Capitolo     Tabella     Fig.         Soggetto
\_langw pl  Rozdział     Tabela      Ilustracja   Temat
\_langw gr  Κεφάλαιο     Πίνακας     Σχήμα        θέμα
\_langw ru  Глава        Таблица     Рисунок      Предмет
\_langw sk  Kapitola     Tabuľka     Obrázok      Vec

   \_doc -----------------------------
   You can add more words as you wish. For example \`\today` macro:
   \_cod -----------------------------

\_def \_monthw #1 #2 #3 #4 #5 #6 #7 {%
   \_sdef{_mt:m1:#1}{#2}\_sdef{_mt:m2:#1}{#3}\_sdef{_mt:m3:#1}{#4}%
   \_sdef{_mt:m4:#1}{#5}\_sdef{_mt:m5:#1}{#5}\_sdef{_mt:m6:#1}{#5}%
   \_monthwB #1
}
\_def \_monthwB #1 #2 #3 #4 #5 #6 #7 {%
   \_sdef{_mt:m7:#1}{#2}\_sdef{_mt:m8:#1}{#3}\_sdef{_mt:m9:#1}{#4}%
   \_sdef{_mt:m10:#1}{#5}\_sdef{_mt:m11:#1}{#5}\_sdef{_mt:m12:#1}{#5}%
}

\_monthw en  January February March April May June
             July August September October November December
\_monthw cs  ledna února března dubna května června
             července srpna září října listopadu prosince
\_monthw sk  januára februára marca apríla mája júna
             júla augusta septembra októbra novembra decembra

\_sdef{_mt:today:en}{\_mtext{m\_the\_month} \_the\_day, \_the\_year}
\_sdef{_mt:today:cs}{\_the\_day.~\_mtext{m\_the\_month} \_the\_year}
\_slet{_mt:today:sk}{_mt:today:cs}

\_def\_today{\_mtext{today}}
\_public \today ;

   \_doc -----------------------------
   Quotes should be tagged by `\"<text>"` and `\'<text>'` if `\<iso-code>quotes` 
   is declared at beginning of the document (for example `\enquotes`). 
   If not, then the control
   sequences `\"` and `\'` are undefined. Remember, that they are used in
   another meaning when `\oldaccents` command is used.
   The macros `\"` and `\'` are not defined as `\protected` because we need
   their expansion when `\outlines` are created.
   User can declare quotes by \`\quoteschars``<clqq><crqq><clq><crq>`, where
   `<clqq>...<crqq>` are normal quotes and `<clq>...<crq>` are alternative quotes.
   or use \`\altquotes` to swap between meaning of these two types of quotes.
   \nl
   \`\enquotes`, \`\csquotes`, \`\dequotes`, \`\frquotes` etc. are defined here.
   \_cod -----------------------------

\_def \_enquotes {\_quoteschars “”‘’}
\_def \_csquotes {\_quoteschars „“‚‘}
\_def \_frquotes {\_quoteschars “”«»}
\_let \_plquotes = \_frquotes
\_let \_esquotes = \_frquotes
\_let \_grquotes = \_frquotes
\_let \_ruquotes = \_frquotes
\_let \_itquotes = \_frquotes
\_let \_skquotes = \_csquotes
\_let \_dequotes = \_csquotes

\_def \_quoteschars #1#2#3#4{\_def\_altquotes{\_quoteschars#3#4#1#2}\_public\altquotes;%
   \_def \"##1"{#1##1#2}\_def \'##1'{#3##1#4}}

   \_doc -----------------------------
   Sometimes should be usable to leave the markup `"such"` or `'such'` i.e.~without
   the first backslash. Then you can make the characters `"` and `'` active
   by the \`\activequotes` macro and leave quotes without first backslash. 
   First, declare `\<iso-code>quotes`, then \^`\altquotes` (if needed) and finally 
   \^`\activequotes`.
   \_cod -----------------------------

\_def\_activequotes{\_ea\_activequotesA\"""\_ea\_activequotesA\'''}
\_def\_activequotesA#1#2#3{\_bgroup\_lccode`\~=`#3\_lowercase{\_egroup\_adef#3##1~{#1##1#2}}}

\_public \quoteschars \activequotes \enquotes \csquotes \skquotes \frquotes \plquotes 
   \esquotes \grquotes \ruquotes \itquotes \dequotes ;

\_endcode % -------------------------------------

2020-04-29 Obrazek -> Abbildung: bug fixed
2020-03-15 introduced