summaryrefslogtreecommitdiff
path: root/macros/optex/base/languages.opm
diff options
context:
space:
mode:
Diffstat (limited to 'macros/optex/base/languages.opm')
-rw-r--r--macros/optex/base/languages.opm147
1 files changed, 53 insertions, 94 deletions
diff --git a/macros/optex/base/languages.opm b/macros/optex/base/languages.opm
index 26e0c62628..4ae66ef1f4 100644
--- a/macros/optex/base/languages.opm
+++ b/macros/optex/base/languages.opm
@@ -1,30 +1,30 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_mtext {Languages <2021-05-23>} % preloaded in format
+\_codedecl \_mtext {Languages <2022-02-19>} % 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>}`,
+ Four words are generated by \OpTeX/ macros: \"Chapter",
+ \"Table", \"Figure" and \"Subject". These phrases are generated depending
+ on the current value of the `\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 the declared word and `<lang>` is a language shortcut
- (iso code).
+ you can define such words by `\sdef{_mt:<phrase-id>:<lang-tag>}` where
+ `<phrase-id>` is a label for the declared word and `<lang-tag>` is a language shortcut
+ declared by \~`\_preplang`.
\_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
+ We can declare such language-dependent words by
+ \begtt
+ \_sdef{_mt:chap:en}{Chapter} \_sdef{_mt:chap:cs}{Kapitola}
+ \_sdef{_mt:t:en}{Table} \_sdef{_mt:t:cs}{Tabulka}
+ \endtt
+ etc. but we use more \"compact" macro
+ \`\_langw` `<lang-tag> <chapter> <table> <figure> <subject>`
+ for declaring them.
\_cod -----------------------------
\_def \_langw #1 #2 #3 #4 #5 {%
@@ -32,20 +32,29 @@
\_sdef{_mt:subj:#1}{#5}%
}
-\_langw en Chapter Table Figure Subject
-%--------------------------------------------------------------
-\_langw cs Kapitola Tabulka Obrázek Věc
-\_langw de Kapitel Tabelle Abbildung Betreff
-\_langw es Capítulo Tabla Figura Sujeto
-\_langw fr Chapitre Tableau Figure Matière
-\_langw it Capitolo Tabella Fig. Oggetto
-\_langw pl Rozdział Tabela Ilustracja Temat
-\_langw gr Κεφάλαιο Πίνακας Σχήμα θέμα
-\_langw ru Глава Таблица Рисунок Предмет
-\_langw sk Kapitola Tabuľka Obrázok Vec
+ \_doc -----------------------------
+ More phrases are auto-generated in bibliography references. They are declared by\nl
+ \`\_langb` `<lang-tag> {<and>} {<et-al>} {<ed>} {<cit>} {<vol>} {<no>} {<pp>} {<p>} {<ed>} {<eds>}`\nl
+ ` {<avail-from>} {<avali-to>} {<ba-thesis>} {<ma-thesis>} {<phd-thesis>}`.
+ It is used similar way as the \^`\_langw` above. Both these macros are used
+ in `lang-data.opm` file, see the end of section~\ref[langdecl].
+ \_cod -----------------------------
+
+\_def\_langb#1 #2#3#4#5#6#7#8#9{\_def\_mbib##1##2{\_sdef{_mt:bib.##2:#1}{##1}}%
+ \_mbib{#2}{and}\_mbib{#3}{etal}\_mbib{#4}{edition}\_mbib{#5}{citedate}\_mbib{#6}{volume}%
+ \_mbib{#7}{number}\_mbib{#8}{prepages}\_mbib{#9}{postpages}\_langbA}
+\_def\_langbA#1#2#3#4#5#6#7{\_mbib{#1}{editor}\_mbib{#2}{editors}\_mbib{#3}{available}%
+ \_mbib{#4}{availablealso}\_mbib{#5}{bachthesis}\_mbib{#6}{masthesis}\_mbib{#7}{phdthesis}}
\_doc -----------------------------
- You can add more words as you wish. For example \`\today` macro:
+ \`\today` macro needs auto-generated words for each name of the month.\nl
+ \`\_monthw` `<lang-tag> <January> <February> ... <December>` is used for
+ decaring them.\nl
+ The language-dependent format for printing date should be declared like
+ \begtt
+ \_sdef{_mt:today:en}{\_mtext{m\_the\_month} \_the\_day, \_the\_year}
+ \endtt
+ This example declares date format for English where <lang-tag> is `en`.
\_cod -----------------------------
\_def \_monthw #1 #2 #3 #4 #5 #6 #7 {%
@@ -57,21 +66,6 @@
\_sdef{_mt:m7:#1}{#2}\_sdef{_mt:m8:#1}{#3}\_sdef{_mt:m9:#1}{#4}%
\_sdef{_mt:m10:#1}{#5}\_sdef{_mt:m11:#1}{#6}\_sdef{_mt:m12:#1}{#7}%
}
-
-\_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
-\_monthw it gennaio febbraio marzo aprile maggio giugno
- luglio agosto settembre ottobre novembre dicembre
-
-
-\_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 ;
@@ -86,24 +80,29 @@
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 the meaning of these two types of quotes.
- \nl
- \`\enquotes`, \`\csquotes`, \`\dequotes`, \`\frquotes` etc. are defined here.
+ \`\enquotes`, \`\csquotes`, \`\frquotes`, \`\dequotes`, \`\skquotes` are defined here.
+ Languages in general provide the \`\quotes` declaration macro. It declares the
+ quotation marks depending on the actual selected language. For example,
+ `\eslang \quotes` declares Spanish language including its quotation marks
+ used for `\"<text>"` and `\'<text>'`. The language-dependent quotation
+ marks should be declared by \`\_quotationmarks` `<lang-tag> {<clqq><crqq><clq><crq>}`
+ in the `lang-data.opm` file.
\_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
+\_let \_skquotes = \_csquotes
+
+\_def \_quotes {\_trycs{_qt:\_trycs{_lan:\_the\_language}{en}}{\_enquotes}}
+\_def \_quotationmarks #1 #2{\_sdef{_qt:#1}{\_quoteschars #2}}
+
+\_public \quotes \enquotes \csquotes \frquotes \dequotes \skquotes ;
\_doc -----------------------------
The \`\quoteschars``<lqq><rqq><lq><rq>` defines `\"` and `\"` as `\_qqA`
- in in normal mode and as expadable macros in outline mode.
+ in normal mode and as expadable macros in outline mode.
We want to well process the common cases: \code{\\"`&`"} or \code{\\"`\{`"}.
This is the reason why the quotes parameter is read in verbatim mode and retokenized
again by `\scantextokens`. We want to allow to quote the quotes mark
@@ -136,52 +135,12 @@
\_def\_activequotes{\_let\_actqq=\"\_adef"{\_actqq}\_let\_actq=\'\_adef'{\_actq}%
\_regmacro{}{}{\_adef"{\"}\_adef'{\'}}}
-\_public \quoteschars \activequotes \enquotes \csquotes \skquotes \frquotes \plquotes
- \esquotes \grquotes \ruquotes \itquotes \dequotes ;
-
- \_doc -----------------------------
- Bibliography references generated by \^`\usebib` uses more
- language-dependent phrases. They are declared here. We don't want to save
- all these phrases into the format, so the trick with {`\_endinput`}
- is used here. When \^`\usebib` is processed then the following part of the file
- `languages.opm` is read again.
-
- Only phrases of few languages are declared here now. If you want to declare
- phrases of your language, please create an \"issue" or a \"request" at
- \url{https://github.com/olsak/OpTeX} or send me an email with new
- phrases for your language (or language you know:). I am ready to put them here.
- Temporarily, you can put your definitions into `\bibtexhook` token list.
- \_cod -----------------------------
-
-\_endinput % don't save these \def's to the format
-
-\_def\_langb#1 #2#3#4#5#6#7#8#9{\_def\_mbib##1##2{\_sdef{_mt:bib.##2:#1}{##1}}%
- \_mbib{#2}{and}\_mbib{#3}{etal}\_mbib{#4}{edition}\_mbib{#5}{citedate}\_mbib{#6}{volume}%
- \_mbib{#7}{number}\_mbib{#8}{prepages}\_mbib{#9}{postpages}\_langbA}
-\_def\_langbA#1#2#3#4#5#6#7{\_mbib{#1}{editor}\_mbib{#2}{editors}\_mbib{#3}{available}%
- \_mbib{#4}{availablealso}\_mbib{#5}{bachthesis}\_mbib{#6}{masthesis}\_mbib{#7}{phdthesis}}
-
-\_langb en {, and } { et al.} { ed.} {cit.~} {Vol.~} {No.~} {pp.~} {~p.} {,~ed.} {,~eds.}
- {Available from } {Available also from }
- {Bachelor's Thesis} {Master's Thesis} {Ph.D. Thesis}
-%------------------------------------------------------------------------------------------
-\_langb cs { a } { a~kol.} { vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editoři}
- {Dostupné na } {Dostupné též na }
- {Bakalářská práce} {Diplomová práce} {Disertační práce}
-\_langb sk { a } { a~kol.} { vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editoři}
- {Dostupné na } {Dostupné tiež na }
- {Bakalárska práca} {Diplomová práca} {Dizertačná práca}
-
-% \_<lang>dateformat year/month/day\relax, for example: \_csdateformat 2020/05/21\relax
-% This is used in iso690 bib-style when the field "citedate" is used.
-
-\_def\_endateformat #1/#2/#3\relax{#1-#2-#3}
-% \_csdateformat 2020/05/21\relax -> \hbox{21. 5. 2020}
-\_def\_csdateformat #1/#2/#3\relax{\hbox{\_tmpnum=#3 \_the\_tmpnum. \_tmpnum=#2 \_the\_tmpnum. #1}}
-\_let\_skdateformat =\_csdateformat
+\_public \quoteschars \activequotes ;
\_endcode % -------------------------------------
+2022-02-19 \quotes, \_quotationmarks introduced
+2022-02-04 \_langinput, words-lan.opm introduced
2021-05-23 \_monthw: bug fix
2021-01-21 more robust quotes in outlines
2020-12-05 bib phrases moved here