summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/languages.opm
blob: b4d6f57d2afcaeff36d4464e2bb193b429b2ff3b (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
%% This is part of OpTeX project, see http://petr.olsak.net/optex

\_codedecl \_mtext {Languages <2020-02-14>}

   \_doc -----------------------------
   Only three words are generated by \OpTeX/ macros: \"Chapter",
   \"Table", \"Figure" and \"Subject". These words can be generated depending 
   on the current value of `\language` register, if you use `\_mtext{chap}`,
   `\_mtext{t}` or `\_mtext{f}`. If your macros generate more words then 
   you can define such words by `\sdef{_mt:<label>:<lang>}` where
   <label> is a label for declared word and <lang> is language shortcut. 
   \_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 efectively. 
   \_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     Obrázek      Subjekt
\_langw es  Capítulo     Tabla       Figura       Sujeto
\_langw fr  Chaptire     Tableau     Figure       Matière
\_langw gr  Κεφάλαιο     Πίνακας     Σχήμα        θέμα
\_langw it  Capitolo     Tabella     Fig.         Soggetto
\_langw pl  Rozdział     Tabela      Ilustracja   Temat
\_langw ru  Глава        Таблица     Рисунок      Предмет
\_langw sk  Kapitola     Tabuľka     Obrázok      Vec

   \_doc -----------------------------
   You can add more words as you wish. For eample `\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 ;


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