Debian Codegraph @

texmf-dist/source/latex/datetime2-estonian/datetime2-estonian.dtx

raw
1 %\iffalse
2 %<*package>
3 %% \CharacterTable
4 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
5 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
6 %% Digits \0\1\2\3\4\5\6\7\8\9
7 %% Exclamation \! Double quote \" Hash (number) \#
8 %% Dollar \$ Percent \% Ampersand \&
9 %% Acute accent \' Left paren \( Right paren \)
10 %% Asterisk \* Plus \+ Comma \,
11 %% Minus \- Point \. Solidus \/
12 %% Colon \: Semicolon \; Less than \<
13 %% Equals \= Greater than \> Question mark \?
14 %% Commercial at \@ Left bracket \[ Backslash \\
15 %% Right bracket \] Circumflex \^ Underscore \_
16 %% Grave accent \` Left brace \{ Vertical bar \|
17 %% Right brace \} Tilde \~}
18 %</package>
19 %\fi
20 % \iffalse
21 % Doc-Source file to use with LaTeX2e
22 % Copyright (C) 2018 Nicola Talbot, all rights reserved.
23 % (New maintainer add relevant lines here.)
24 % \fi
25 % \iffalse
26 %<*driver>
27 \documentclass{ltxdoc}
28
29 \usepackage{alltt}
30 \usepackage{graphicx}
31 \usepackage{fontspec}
32 \usepackage[colorlinks,
33 bookmarks,
34 hyperindex=false,
35 pdfauthor={Nicola L.C. Talbot},
36 pdftitle={datetime2.sty Estonian Module}]{hyperref}
37
38 \setmainfont{Liberation Serif}
39 \setmonofont{Liberation Mono}
40
41 \CheckSum{265}
42
43 \renewcommand*{\usage}[1]{\hyperpage{#1}}
44 \renewcommand*{\main}[1]{\hyperpage{#1}}
45 \IndexPrologue{\section*{\indexname}\markboth{\indexname}{\indexname}}
46 \setcounter{IndexColumns}{2}
47
48 \newcommand*{\sty}[1]{\textsf{#1}}
49 \newcommand*{\opt}[1]{\texttt{#1}\index{#1=\texttt{#1}|main}}
50
51 \RecordChanges
52 \PageIndex
53 \CodelineNumbered
54
55 \begin{document}
56 \DocInput{datetime2-estonian.dtx}
57 \end{document}
58 %</driver>
59 %\fi
60 %
61 %\MakeShortVerb{"}
62 %
63 %\title{Estonian Module for datetime2 Package}
64 %\author{Nicola L. C. Talbot (inactive)}
65 %\date{2018-04-13 (v1.1)}
66 %\maketitle
67 %
68 %This module is currently unmaintained and may be subject to change.
69 %If you want to volunteer to take over maintanance, contact me at
70 %\url{http://www.dickimaw-books.com/contact.html}
71 %
72 %\begin{abstract}
73 %This is the Estonian language module for the \sty{datetime2}
74 %package. If you want to use the settings in this module you must
75 %install it in addition to installing \sty{datetime2}. If you use
76 %\sty{babel} or \sty{polyglossia}, you will need this module to
77 %prevent them from redefining \cs{today}. The \sty{datetime2}
78 % \opt{useregional} setting must be set to "text" or "numeric"
79 % for the language styles to be set.
80 % Alternatively, you can set the style in the document using
81 % \cs{DTMsetstyle}, but this may be changed by \cs{date}\meta{language}
82 % depending on the value of the \opt{useregional} setting.
83 %\end{abstract}
84 %
85 %I've copied the date style from \texttt{babel-estonian}'s \cs{today}.
86 %
87 %I don't know if these settings are correct as I can't speak Estonian.
88 %In particular, I don't know if the "estonian" time style is
89 %correct. Currently this just uses the "default" time style. Please
90 %be aware that this may change. Whoever takes over maintanance
91 %of this module may can change it as appropriate.
92 %
93 %The new maintainer should add the line:
94 %\begin{verbatim}
95 % The Current Maintainer of this work is Name.
96 %\end{verbatim}
97 %to the preamble part in \texttt{datetime2-estonian.ins} where Name
98 %is the name of the maintainer(s) and replace
99 %the `inactive' status to `maintained'.
100 %
101 %Currently there is only a regionless style.
102 %
103 %\StopEventually{%
104 %\clearpage
105 %\phantomsection
106 %\addcontentsline{toc}{section}{Change History}%
107 %\PrintChanges
108 %\addcontentsline{toc}{section}{\indexname}%
109 %\PrintIndex}
110 %\section{The Code}
111 %\iffalse
112 % \begin{macrocode}
113 %<*datetime2-estonian-utf8.ldf>
114 % \end{macrocode}
115 %\fi
116 %\subsection{UTF-8}
117 %This file contains the settings that use UTF-8 characters. This
118 %file is loaded if XeLaTeX or LuaLaTeX are used. Please make sure
119 %your text editor is set to UTF-8 if you want to view this code.
120 %\changes{1.0}{2015-03-30}{Initial release}
121 % Identify module
122 % \begin{macrocode}
123 \ProvidesDateTimeModule{estonian-utf8}[2018/04/13 v1.1]
124 % \end{macrocode}
125 %\begin{macro}{\DTMestonianordinal}
126 % \begin{macrocode}
127 \newcommand*{\DTMestonianordinal}[1]{%
128 \number#1.%
129 }
130 % \end{macrocode}
131 %\end{macro}
132 %
133 %\begin{macro}{\DTMestonianyear}
134 % \begin{macrocode}
135 \newcommand*{\DTMestonianyear}[1]{%
136 \number#1.\space a.%
137 }
138 % \end{macrocode}
139 %\end{macro}
140 %
141 %
142 %\begin{macro}{\DTMestonianmonthname}
143 % Estonian month names.
144 % \begin{macrocode}
145 \newcommand*{\DTMestonianmonthname}[1]{%
146 \ifcase#1
147 \or
148 jaanuar%
149 \or
150 veebruar%
151 \or
152 mäarts%
153 \or
154 aprill%
155 \or
156 mai%
157 \or
158 juuni%
159 \or
160 juuli%
161 \or
162 august%
163 \or
164 september%
165 \or
166 oktoober%
167 \or
168 november%
169 \or
170 detsember%
171 \fi
172 }
173 % \end{macrocode}
174 %\end{macro}
175 %
176 %\begin{macro}{\DTMestonianMonthname}
177 % As above but capitalize.
178 % \begin{macrocode}
179 \newcommand*{\DTMestonianMonthname}[1]{%
180 \ifcase#1
181 \or
182 Jaanuar%
183 \or
184 Veebruar%
185 \or
186 Mäarts%
187 \or
188 Aprill%
189 \or
190 Mai%
191 \or
192 Juuni%
193 \or
194 Juuli%
195 \or
196 August%
197 \or
198 September%
199 \or
200 Oktoober%
201 \or
202 November%
203 \or
204 Detsember%
205 \fi
206 }
207 % \end{macrocode}
208 %\end{macro}
209 %
210 %If abbreviated dates are supported, short month names should be
211 %likewise provided.
212 %
213 %\iffalse
214 % \begin{macrocode}
215 %</datetime2-estonian-utf8.ldf>
216 % \end{macrocode}
217 %\fi
218 %\iffalse
219 % \begin{macrocode}
220 %<*datetime2-estonian-ascii.ldf>
221 % \end{macrocode}
222 %\fi
223 %\subsection{ASCII}
224 %This file contains the settings that use \LaTeX\ commands for
225 %non-ASCII characters. This should be input if neither XeLaTeX nor
226 %LuaLaTeX are used. Even if the user has loaded \sty{inputenc} with
227 %"utf8", this file should still be used not the
228 %\texttt{datetime2-estonian-utf8.ldf} file as the non-ASCII
229 %characters are made active in that situation and would need
230 %protecting against expansion.
231 %\changes{1.0}{2015-03-30}{Initial release}
232 % Identify module
233 % \begin{macrocode}
234 \ProvidesDateTimeModule{estonian-ascii}[2018/04/13 v1.1]
235 % \end{macrocode}
236 %
237 %If abbreviated dates are supported, short month names should be
238 %likewise provided.
239 %\begin{macro}{\DTMestonianordinal}
240 % \begin{macrocode}
241 \newcommand*{\DTMestonianordinal}[1]{%
242 \number#1.%
243 }
244 % \end{macrocode}
245 %\end{macro}
246 %
247 %\begin{macro}{\DTMestonianyear}
248 % \begin{macrocode}
249 \newcommand*{\DTMestonianyear}[1]{%
250 \number#1.\space a.%
251 }
252 % \end{macrocode}
253 %\end{macro}
254 %
255 %\begin{macro}{\DTMestonianmonthname}
256 % Estonian month names.
257 % \begin{macrocode}
258 \newcommand*{\DTMestonianmonthname}[1]{%
259 \ifcase#1
260 \or
261 jaanuar%
262 \or
263 veebruar%
264 \or
265 m\protect\"arts%
266 \or
267 aprill%
268 \or
269 mai%
270 \or
271 juuni%
272 \or
273 juuli%
274 \or
275 august%
276 \or
277 september%
278 \or
279 oktoober%
280 \or
281 november%
282 \or
283 detsember%
284 \fi
285 }
286 % \end{macrocode}
287 %\end{macro}
288 %
289 %\begin{macro}{\DTMestonianMonthname}
290 % As above but capitalize.
291 % \begin{macrocode}
292 \newcommand*{\DTMestonianMonthname}[1]{%
293 \ifcase#1
294 \or
295 Jaanuar%
296 \or
297 Veebruar%
298 \or
299 M\protect\"arts%
300 \or
301 Aprill%
302 \or
303 Mai%
304 \or
305 Juuni%
306 \or
307 Juuli%
308 \or
309 August%
310 \or
311 September%
312 \or
313 Oktoober%
314 \or
315 November%
316 \or
317 Detsember%
318 \fi
319 }
320 % \end{macrocode}
321 %\end{macro}
322 %
323 %\iffalse
324 % \begin{macrocode}
325 %</datetime2-estonian-ascii.ldf>
326 % \end{macrocode}
327 %\fi
328 %
329 %\subsection{Main Estonian Module (\texttt{datetime2-estonian.ldf})}
330 %\changes{1.0}{2015-03-30}{Initial release}
331 %
332 %\iffalse
333 % \begin{macrocode}
334 %<*datetime2-estonian.ldf>
335 % \end{macrocode}
336 %\fi
337 %
338 % Identify Module
339 % \begin{macrocode}
340 \ProvidesDateTimeModule{estonian}[2018/04/13 v1.1]
341 % \end{macrocode}
342 % Need to find out if XeTeX or LuaTeX are being used.
343 % \begin{macrocode}
344 \RequirePackage{ifxetex,ifluatex}
345 % \end{macrocode}
346 % XeTeX and LuaTeX natively support UTF-8, so load
347 % \texttt{estonian-utf8} if either of those engines are used
348 % otherwise load \texttt{estonian-ascii}.
349 % \begin{macrocode}
350 \ifxetex
351 \RequireDateTimeModule{estonian-utf8}
352 \else
353 \ifluatex
354 \RequireDateTimeModule{estonian-utf8}
355 \else
356 \RequireDateTimeModule{estonian-ascii}
357 \fi
358 \fi
359 % \end{macrocode}
360 %
361 % Define the \texttt{estonian} style.
362 % The time style is the same as the "default" style
363 % provided by \sty{datetime2}. This may need correcting. For
364 % example, if a 12 hour style similar to the "englishampm" (from the
365 % "english-base" module) is required.
366 %
367 % Allow the user a way of configuring the "estonian" and
368 % "estonian-numeric" styles. This doesn't use the package wide
369 % separators such as
370 % \cs{dtm@datetimesep} in case other date formats are also required.
371 %\begin{macro}{\DTMestoniandaymonthsep}
372 % The separator between the day and month for the text format.
373 % \begin{macrocode}
374 \newcommand*{\DTMestoniandaymonthsep}{\space}
375 % \end{macrocode}
376 %\end{macro}
377 %
378 %\begin{macro}{\DTMestonianmonthyearsep}
379 % The separator between the month and year for the text format.
380 % \begin{macrocode}
381 \newcommand*{\DTMestonianmonthyearsep}{\space}
382 % \end{macrocode}
383 %\end{macro}
384 %
385 %\begin{macro}{\DTMestoniandatetimesep}
386 % The separator between the date and time blocks in the full format
387 % (either text or numeric).
388 % \begin{macrocode}
389 \newcommand*{\DTMestoniandatetimesep}{\space}
390 % \end{macrocode}
391 %\end{macro}
392 %
393 %\begin{macro}{\DTMestoniantimezonesep}
394 % The separator between the time and zone blocks in the full format
395 % (either text or numeric).
396 % \begin{macrocode}
397 \newcommand*{\DTMestoniantimezonesep}{\space}
398 % \end{macrocode}
399 %\end{macro}
400 %
401 %\begin{macro}{\DTMestoniandatesep}
402 % The separator for the numeric date format.
403 % \begin{macrocode}
404 \newcommand*{\DTMestoniandatesep}{.}
405 % \end{macrocode}
406 %\end{macro}
407 %
408 %\begin{macro}{\DTMestoniantimesep}
409 % The separator for the numeric time format.
410 % \begin{macrocode}
411 \newcommand*{\DTMestoniantimesep}{:}
412 % \end{macrocode}
413 %\end{macro}
414 %
415 %Provide keys that can be used in \cs{DTMlangsetup} to set these
416 %separators.
417 % \begin{macrocode}
418 \DTMdefkey{estonian}{daymonthsep}{\renewcommand*{\DTMestoniandaymonthsep}{#1}}
419 \DTMdefkey{estonian}{monthyearsep}{\renewcommand*{\DTMestonianmonthyearsep}{#1}}
420 \DTMdefkey{estonian}{datetimesep}{\renewcommand*{\DTMestoniandatetimesep}{#1}}
421 \DTMdefkey{estonian}{timezonesep}{\renewcommand*{\DTMestoniantimezonesep}{#1}}
422 \DTMdefkey{estonian}{datesep}{\renewcommand*{\DTMestoniandatesep}{#1}}
423 \DTMdefkey{estonian}{timesep}{\renewcommand*{\DTMestoniantimesep}{#1}}
424 % \end{macrocode}
425 %
426 % TODO: provide a boolean key to switch between full and abbreviated
427 % formats if appropriate. (I don't know how the date should be
428 % abbreviated.)
429 %
430 % Define a boolean key that determines if the time zone mappings
431 % should be used.
432 % \begin{macrocode}
433 \DTMdefboolkey{estonian}{mapzone}[true]{}
434 % \end{macrocode}
435 % The default is to use mappings.
436 % \begin{macrocode}
437 \DTMsetbool{estonian}{mapzone}{true}
438 % \end{macrocode}
439 %
440 % Define a boolean key that determines if the day of month should be
441 % displayed.
442 % \begin{macrocode}
443 \DTMdefboolkey{estonian}{showdayofmonth}[true]{}
444 % \end{macrocode}
445 % The default is to show the day of month.
446 % \begin{macrocode}
447 \DTMsetbool{estonian}{showdayofmonth}{true}
448 % \end{macrocode}
449 %
450 % Define a boolean key that determines if the year should be
451 % displayed.
452 % \begin{macrocode}
453 \DTMdefboolkey{estonian}{showyear}[true]{}
454 % \end{macrocode}
455 % The default is to show the year.
456 % \begin{macrocode}
457 \DTMsetbool{estonian}{showyear}{true}
458 % \end{macrocode}
459 %
460 % Define the "estonian" style. (TODO: implement day of week?)
461 % \begin{macrocode}
462 \DTMnewstyle
463 {estonian}% label
464 {% date style
465 \renewcommand*\DTMdisplaydate[4]{%
466 \DTMifbool{estonian}{showdayofmonth}
467 {\DTMestonianordinal{##3}\DTMestoniandaymonthsep}%
468 {}%
469 \DTMestonianmonthname{##2}%
470 \DTMifbool{estonian}{showyear}%
471 {%
472 \DTMestonianmonthyearsep
473 \DTMestonianyear{\number##1}%
474 }%
475 {}%
476 }%
477 \renewcommand*\DTMDisplaydate[4]{%
478 \DTMifbool{estonian}{showdayofmonth}
479 {%
480 \DTMestonianordinal{##3}\DTMestoniandaymonthsep
481 \DTMestonianmonthname{##2}%
482 }%
483 {%
484 \DTMestonianMonthname{##2}%
485 }%
486 \DTMifbool{estonian}{showyear}%
487 {%
488 \DTMestonianmonthyearsep
489 \DTMestonianyear{\number##1}%
490 }%
491 {}%
492 }%
493 }%
494 {% time style (use default)
495 \DTMsettimestyle{default}%
496 }%
497 {% zone style
498 \DTMresetzones
499 \DTMestonianzonemaps
500 \renewcommand*{\DTMdisplayzone}[2]{%
501 \DTMifbool{estonian}{mapzone}%
502 {\DTMusezonemapordefault{##1}{##2}}%
503 {%
504 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
505 \ifDTMshowzoneminutes\DTMestoniantimesep\DTMtwodigits{##2}\fi
506 }%
507 }%
508 }%
509 {% full style
510 \renewcommand*{\DTMdisplay}[9]{%
511 \ifDTMshowdate
512 \DTMdisplaydate{##1}{##2}{##3}{##4}%
513 \DTMestoniandatetimesep
514 \fi
515 \DTMdisplaytime{##5}{##6}{##7}%
516 \ifDTMshowzone
517 \DTMestoniantimezonesep
518 \DTMdisplayzone{##8}{##9}%
519 \fi
520 }%
521 \renewcommand*{\DTMDisplay}[9]{%
522 \ifDTMshowdate
523 \DTMDisplaydate{##1}{##2}{##3}{##4}%
524 \DTMestoniandatetimesep
525 \fi
526 \DTMdisplaytime{##5}{##6}{##7}%
527 \ifDTMshowzone
528 \DTMestoniantimezonesep
529 \DTMdisplayzone{##8}{##9}%
530 \fi
531 }%
532 }%
533 % \end{macrocode}
534 %
535 % Define numeric style.
536 % \begin{macrocode}
537 \DTMnewstyle
538 {estonian-numeric}% label
539 {% date style
540 \renewcommand*\DTMdisplaydate[4]{%
541 \DTMifbool{estonian}{showdayofmonth}%
542 {%
543 \number##3 % space intended
544 \DTMestoniandatesep
545 }%
546 {}%
547 \number##2 % space intended
548 \DTMifbool{estonian}{showyear}%
549 {%
550 \DTMestoniandatesep
551 \number##1 % space intended
552 }%
553 {}%
554 }%
555 \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}%
556 }%
557 {% time style
558 \renewcommand*\DTMdisplaytime[3]{%
559 \number##1
560 \DTMestoniantimesep\DTMtwodigits{##2}%
561 \ifDTMshowseconds\DTMestoniantimesep\DTMtwodigits{##3}\fi
562 }%
563 }%
564 {% zone style
565 \DTMresetzones
566 \DTMestonianzonemaps
567 \renewcommand*{\DTMdisplayzone}[2]{%
568 \DTMifbool{estonian}{mapzone}%
569 {\DTMusezonemapordefault{##1}{##2}}%
570 {%
571 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
572 \ifDTMshowzoneminutes\DTMestoniantimesep\DTMtwodigits{##2}\fi
573 }%
574 }%
575 }%
576 {% full style
577 \renewcommand*{\DTMdisplay}[9]{%
578 \ifDTMshowdate
579 \DTMdisplaydate{##1}{##2}{##3}{##4}%
580 \DTMestoniandatetimesep
581 \fi
582 \DTMdisplaytime{##5}{##6}{##7}%
583 \ifDTMshowzone
584 \DTMestoniantimezonesep
585 \DTMdisplayzone{##8}{##9}%
586 \fi
587 }%
588 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
589 }
590 % \end{macrocode}
591 %
592 %\begin{macro}{\DTMestonianzonemaps}
593 % The time zone mappings are set through this command, which can be
594 % redefined if extra mappings are required or mappings need to be
595 % removed. No default mappings are provided at the moment.
596 % \begin{macrocode}
597 \newcommand*{\DTMestonianzonemaps}{%
598 \DTMdefzonemap{02}{00}{EET}%
599 \DTMdefzonemap{03}{00}{EEST}%
600 }
601 % \end{macrocode}
602 %\end{macro}
603
604 % Switch style according to the \opt{useregional} setting.
605 % \begin{macrocode}
606 \DTMifcaseregional
607 {}% do nothing
608 {\DTMsetstyle{estonian}}
609 {\DTMsetstyle{estonian-numeric}}
610 % \end{macrocode}
611 %
612 % Redefine \cs{dateestonian} (or \cs{date}\meta{dialect}) to prevent
613 % \sty{babel} from resetting \cs{today}. (For this to work,
614 % \sty{babel} must already have been loaded if it's required.)
615 %\changes{1.1}{2018-04-13}{removed spurious space}
616 % \begin{macrocode}
617 \ifcsundef{date\CurrentTrackedDialect}
618 {%
619 \ifundef\dateestonian
620 {% do nothing
621 }%
622 {%
623 \def\dateestonian{%
624 \DTMifcaseregional
625 {}% do nothing
626 {\DTMsetstyle{estonian}}%
627 {\DTMsetstyle{estonian-numeric}}%
628 }%
629 }%
630 }%
631 {%
632 \csdef{date\CurrentTrackedDialect}{%
633 \DTMifcaseregional
634 {}% do nothing
635 {\DTMsetstyle{estonian}}%
636 {\DTMsetstyle{estonian-numeric}}%
637 }%
638 }%
639 % \end{macrocode}
640 %\iffalse
641 % \begin{macrocode}
642 %</datetime2-estonian.ldf>
643 % \end{macrocode}
644 %\fi
645 %\Finale
646 \endinput