Debian Codegraph @

texmf-dist/source/latex/datetime2-basque/datetime2-basque.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) 2015 Nicola Talbot
23 % Copyright (C) 2015-2018 Zunbeltz Izaola, all rights reserved.
24 % Maintainer Zunbeltz Izaola. Based on the basque-date package by Edorta Ibarra.
25 % \fi
26 % \iffalse
27 %<*driver>
28 \documentclass{ltxdoc}
29
30 \usepackage{alltt}
31 \usepackage{graphicx}
32 \usepackage[utf8]{inputenc}
33 \usepackage[T1]{fontenc}
34 \usepackage[colorlinks,
35 bookmarks,
36 hyperindex=false,
37 pdfauthor={Nicola L.C. Talbot},
38 pdftitle={datetime2.sty Basque Module}]{hyperref}
39
40
41 \CheckSum{377}
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-basque.dtx}
57 \end{document}
58 %</driver>
59 %\fi
60 %
61 %\MakeShortVerb{"}
62 %
63 %\title{Basque Module for datetime2 Package}
64 %\author{Zunbeltz Izaola \and Nicola L. C. Talbot (inactive)}
65 %\date{2018-03-20 (v1.2a)}
66 %\maketitle
67 %
68 %
69 %\begin{abstract}
70 %This is the Basque language module for the \sty{datetime2}
71 %package. If you want to use the settings in this module you must
72 %install it in addition to installing \sty{datetime2}. If you use
73 %\sty{babel} or \sty{polyglossia}, you will need this module to
74 %prevent them from redefining \cs{today}. The \sty{datetime2}
75 % \opt{useregional} setting must be set to "text" or "numeric"
76 % for the language styles to be set.
77 % Alternatively, you can set the style in the document using
78 % \cs{DTMsetstyle}, but this may be changed by \cs{date}\meta{language}
79 % depending on the value of the \opt{useregional} setting.
80 % Currently there is only a regionless style.
81 %\end{abstract}
82 %
83 % \section{Introduction}
84 %
85 % According to The Basque Language Academy (\textit{Euskaltzaindia}), there
86 % are various correct forms to display the date in Basque.\footnote{\textit{37.
87 % araua. Data nola adierazi}: \url{http://euskaltzaindia.net/dok/arauak/Araua\_0037.pdf}}
88 % The most used form, which includes the name of the location where the document or
89 % text has been written, is the following:
90 %
91 % \begin{center}
92 % \textit{Durango(n), 1983ko martxoaren 7a(n)},
93 % \end{center}
94 % where the inessive case \textit{``n''} is optional. It must be taken into account
95 % that the declination of numbers in Basque is not straightforward.
96 % The inessive case is deactivated by default. To activate it, set the
97 % \sty{inessive} boolean option to \sty{true} with \cs{DTMlangsetup}:
98 % \begin{verbatim}
99 % \DTMlangsetup[basque]{inessive=true}
100 % \end{verbatim}
101
102 %\StopEventually{%
103 %\clearpage
104 %\phantomsection
105 %\addcontentsline{toc}{section}{Change History}%
106 %\PrintChanges
107 %\addcontentsline{toc}{section}{\indexname}%
108 %\PrintIndex}
109 %
110 %\section{The Code}
111 %At the moment there is only the one ".ldf" file.
112 %
113 %\subsection{Main Basque Module (\texttt{datetime2-basque.ldf})}
114 %\changes{1.0}{2015-03-29}{Initial release}
115 %
116 %\iffalse
117 % \begin{macrocode}
118 %<*datetime2-basque.ldf>
119 % \end{macrocode}
120 %\fi
121 %
122 % Identify Module
123 % \begin{macrocode}
124 \ProvidesDateTimeModule{basque}[2018/03/20 v1.2a]
125 % \end{macrocode}
126 %
127 % Define a boolean to use the inessive case. It is not used by default.
128 %
129 % \begin{macrocode}
130 \DTMdefboolkey{basque}{inessive}[false]{}
131 % \end{macrocode}
132
133 %\begin{macro}{\DTMbasqueordinal}
134 % Numbers are declined according to to the case.
135 % \begin{macrocode}
136 \newcommand*{\DTMbasqueordinal}[1]{%
137 \number#1%
138 \DTMifbool{basque}{inessive}{%
139 \ifcase\number#1 %declination for the day (inessive case)
140 \or ean\or an\or an\or an\or ean\or an\or an\or an\or an\or ean\or
141 n\or an\or an\or an\or ean\or an\or an\or an\or an\or an\or ean\or
142 an\or an\or an\or ean\or an\or an\or an\or an\or ean\or n\fi%
143 }{%
144 \ifcase\number#1 %declination for the day (absolutive case)
145 \or a\or a\or a\or a\or a\or a\or a\or a\or a\or a\or \or
146 a\or a\or a\or a\or a\or a\or a\or a\or a\or a\or a\or a\or
147 a\or a\or a\or a\or a\or a\or a\or\fi%
148 }%
149 }
150 % \end{macrocode}
151 %\end{macro}
152 %
153 %\begin{macro}{\DTMbasquemonthname}
154 % Basque declined month names.
155 % \begin{macrocode}
156 \newcommand*{\DTMbasquemonthname}[1]{%
157 \ifcase#1
158 \or
159 urtarrilaren%
160 \or
161 otsailaren%
162 \or
163 martxoaren%
164 \or
165 apirilaren%
166 \or
167 maiatzaren%
168 \or
169 ekainaren%
170 \or
171 uztailaren%
172 \or
173 abuztuaren%
174 \or
175 irailaren%
176 \or
177 urriaren%
178 \or
179 azaroaren%
180 \or
181 abenduaren%
182 \fi
183 }
184 % \end{macrocode}
185 %\end{macro}
186 %
187 %\begin{macro}{\DTMbasqueMonthname}
188 % As above but start with a capital.
189 % \begin{macrocode}
190 \newcommand*{\DTMbasqueMonthname}[1]{%
191 \ifcase#1
192 \or
193 Urtarrilaren%
194 \or
195 Otsailaren%
196 \or
197 Martxoaren%
198 \or
199 Apirilaren%
200 \or
201 Maiatzaren%
202 \or
203 Ekainaren%
204 \or
205 Uztailaren%
206 \or
207 Abuztuaren%
208 \or
209 Irailaren%
210 \or
211 Urriaren%
212 \or
213 Azaroaren%
214 \or
215 Abenduaren%
216 \fi
217 }
218 % \end{macrocode}
219 %\end{macro}
220 %
221 % Define the \texttt{basque} style.
222 % The time style is the same as the "default" style
223 % provided by \sty{datetime2}. This may need correcting. For
224 % example, if a 12 hour style similar to the "englishampm" (from the
225 % "english-base" module) is required.
226 %
227 % Allow the user a way of configuring the "basque" and
228 % "basque-numeric" styles. This doesn't use the package wide
229 % separators such as
230 % \cs{dtm@datetimesep} in case other date formats are also required.
231 %\begin{macro}{\DTMbasquemonthdaysep}
232 % The separator between the day and month for the text format.
233 % \begin{macrocode}
234 \newcommand*{\DTMbasquemonthdaysep}{%
235 \DTMtexorpdfstring{\protect~}{\space}}
236 % \end{macrocode}
237 %\end{macro}
238 %
239 %\begin{macro}{\DTMbasqueyearmonthsep}
240 % The separator between the month and year for the text format.
241 % According to the Basque declination rules for year
242 % \begin{macrocode}
243 \newcommand*{\DTMbasqueyearmonthsep}{\ifcase\DTMtwodigits{\@dtm@currentyear}
244 %Declination for the year
245 %00-20
246 ko \or eko \or ko \or ko \or ko \or eko \or ko
247 \or ko \or ko \or ko \or eko \or ko \or ko
248 \or ko \or ko \or eko \or ko \or ko \or ko
249 \or ko \or ko \or
250 %21-40
251 eko \or ko \or ko \or ko \or eko \or ko
252 \or ko \or ko \or ko \or eko \or ko \or ko
253 \or ko \or ko \or eko \or ko \or ko \or ko
254 \or ko \or ko \or
255 %41-60
256 eko \or ko \or ko \or ko \or eko \or ko
257 \or ko \or ko \or ko \or eko \or ko \or ko
258 \or ko \or ko \or eko \or ko \or ko \or ko
259 \or ko \or ko \or
260 %61-80
261 eko \or ko \or ko \or ko \or eko \or ko
262 \or ko \or ko \or ko \or eko \or ko \or ko
263 \or ko \or ko \or eko \or ko \or ko \or ko
264 \or ko \or ko \or
265 %81-100
266 eko \or ko \or ko \or ko \or eko \or ko
267 \or ko \or ko \or ko \or eko \or ko \or ko
268 \or ko \or ko \or eko \or ko \or ko \or ko
269 \or ko \or eko
270 \fi%
271 }
272 % \end{macrocode}
273 %\end{macro}
274 %
275 %\begin{macro}{\DTMbasquedatetimesep}
276 % The separator between the date and time blocks in the full format
277 % (either text or numeric).
278 % \begin{macrocode}
279 \newcommand*{\DTMbasquedatetimesep}{\space}
280 % \end{macrocode}
281 %\end{macro}
282 %
283 %\begin{macro}{\DTMbasquetimezonesep}
284 % The separator between the time and zone blocks in the full format
285 % (either text or numeric).
286 % \begin{macrocode}
287 \newcommand*{\DTMbasquetimezonesep}{\space}
288 % \end{macrocode}
289 %\end{macro}
290 %
291 %\begin{macro}{\DTMbasquedatesep}
292 % The separator for the numeric date format.
293 %
294 % There is no clear tradition for the puctuation mark to separe the numbers.
295 % Spanish tradition will use either slash (/) or en-dash (-). I couldn't find typographic guidelines on the french tradition.
296 % I choose the slash over the en-dash because I found that more compact dates are nicer.
297 %
298 % \begin{macrocode}
299 \newcommand*{\DTMbasquedatesep}{/}
300 % \end{macrocode}
301 %\end{macro}
302 %
303 %\begin{macro}{\DTMbasquetimesep}
304 % The separator for the numeric time format.
305 % \begin{macrocode}
306 \newcommand*{\DTMbasquetimesep}{:}
307 % \end{macrocode}
308 %\end{macro}
309 %
310 %Provide keys that can be used in \cs{DTMlangsetup} to set these
311 %separators.
312 % \begin{macrocode}
313 \DTMdefkey{basque}{monthdaysep}{\renewcommand*{\DTMbasquemonthdaysep}{#1}}
314 \DTMdefkey{basque}{yearmonthsep}{\renewcommand*{\DTMbasqueyearmonthsep}{#1}}
315 \DTMdefkey{basque}{datetimesep}{\renewcommand*{\DTMbasquedatetimesep}{#1}}
316 \DTMdefkey{basque}{timezonesep}{\renewcommand*{\DTMbasquetimezonesep}{#1}}
317 \DTMdefkey{basque}{datesep}{\renewcommand*{\DTMbasquedatesep}{#1}}
318 \DTMdefkey{basque}{timesep}{\renewcommand*{\DTMbasquetimesep}{#1}}
319 % \end{macrocode}
320 %
321 % TODO: provide a boolean key to switch between full and abbreviated
322 % formats if appropriate. (I don't know how the date should be
323 % abbreviated.)
324 %
325 % Define a boolean key that determines if the time zone mappings
326 % should be used.
327 % \begin{macrocode}
328 \DTMdefboolkey{basque}{mapzone}[true]{}
329 % \end{macrocode}
330 % The default is to use mappings.
331 % \begin{macrocode}
332 \DTMsetbool{basque}{mapzone}{true}
333 % \end{macrocode}
334 %
335 % Define a boolean key that determines if the day of month should be
336 % displayed.
337 % \begin{macrocode}
338 \DTMdefboolkey{basque}{showdayofmonth}[true]{}
339 % \end{macrocode}
340 % The default is to show the day of month.
341 % \begin{macrocode}
342 \DTMsetbool{basque}{showdayofmonth}{true}
343 % \end{macrocode}
344 %
345 % Define a boolean key that determines if the year should be
346 % displayed.
347 % \begin{macrocode}
348 \DTMdefboolkey{basque}{showyear}[true]{}
349 % \end{macrocode}
350 % The default is to show the year.
351 % \begin{macrocode}
352 \DTMsetbool{basque}{showyear}{true}
353 % \end{macrocode}
354 %
355 % Define the "basque" style. (TODO: implement day of week?)
356 % \begin{macrocode}
357 \DTMnewstyle
358 {basque}% label
359 {% date style
360 \renewcommand*\DTMdisplaydate[4]{%
361 \DTMifbool{basque}{showyear}%
362 {%
363 \number##1%
364 \DTMbasqueyearmonthsep
365 }%
366 {}%
367 \DTMbasquemonthname{##2}%
368 \DTMifbool{basque}{showdayofmonth}
369 {\DTMbasquemonthdaysep\DTMbasqueordinal{##3}}%
370 {}%
371 }%
372 \renewcommand*\DTMDisplaydate[4]{%
373 \DTMifbool{basque}{showyear}%
374 {%
375 \number##1%
376 \DTMbasqueyearmonthsep
377 \DTMbasquemonthname{##2}%
378 }%
379 {%
380 \DTMbasqueMonthname{##2}%
381 }%
382 \DTMifbool{basque}{showdayofmonth}
383 {\DTMbasquemonthdaysep\DTMbasqueordinal{##3}}%
384 {}%
385 }%
386 }%
387 {% time style (use default)
388 \DTMsettimestyle{default}%
389 }%
390 {% zone style
391 \DTMresetzones
392 \DTMbasquezonemaps
393 \renewcommand*{\DTMdisplayzone}[2]{%
394 \DTMifbool{basque}{mapzone}%
395 {\DTMusezonemapordefault{##1}{##2}}%
396 {%
397 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
398 \ifDTMshowzoneminutes\DTMbasquetimesep\DTMtwodigits{##2}\fi
399 }%
400 }%
401 }%
402 {% full style
403 \renewcommand*{\DTMdisplay}[9]{%
404 \ifDTMshowdate
405 \DTMdisplaydate{##1}{##2}{##3}{##4}%
406 \DTMbasquedatetimesep
407 \fi
408 \DTMdisplaytime{##5}{##6}{##7}%
409 \ifDTMshowzone
410 \DTMbasquetimezonesep
411 \DTMdisplayzone{##8}{##9}%
412 \fi
413 }%
414 \renewcommand*{\DTMDisplay}[9]{%
415 \ifDTMshowdate
416 \DTMDisplaydate{##1}{##2}{##3}{##4}%
417 \DTMbasquedatetimesep
418 \fi
419 \DTMdisplaytime{##5}{##6}{##7}%
420 \ifDTMshowzone
421 \DTMbasquetimezonesep
422 \DTMdisplayzone{##8}{##9}%
423 \fi
424 }%
425 }%
426 % \end{macrocode}
427 %
428 % Define numeric style.
429 % \begin{macrocode}
430 \DTMnewstyle
431 {basque-numeric}% label
432 {% date style
433 \renewcommand*\DTMdisplaydate[4]{%
434 \DTMifbool{basque}{showyear}%
435 {%
436 \number##1%
437 \DTMbasquedatesep
438 }%
439 {}%
440 \number##2%
441 \DTMifbool{basque}{showdayofmonth}%
442 {%
443 \DTMbasquedatesep
444 \number##3 % space intended
445 }%
446 {}%
447 }%
448 \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}%
449 }%
450 {% time style
451 \renewcommand*\DTMdisplaytime[3]{%
452 \number##1
453 \DTMbasquetimesep\DTMtwodigits{##2}%
454 \ifDTMshowseconds\DTMbasquetimesep\DTMtwodigits{##3}\fi
455 }%
456 }%
457 {% zone style
458 \DTMresetzones
459 \DTMbasquezonemaps
460 \renewcommand*{\DTMdisplayzone}[2]{%
461 \DTMifbool{basque}{mapzone}%
462 {\DTMusezonemapordefault{##1}{##2}}%
463 {%
464 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
465 \ifDTMshowzoneminutes\DTMbasquetimesep\DTMtwodigits{##2}\fi
466 }%
467 }%
468 }%
469 {% full style
470 \renewcommand*{\DTMdisplay}[9]{%
471 \ifDTMshowdate
472 \DTMdisplaydate{##1}{##2}{##3}{##4}%
473 \DTMbasquedatetimesep
474 \fi
475 \DTMdisplaytime{##5}{##6}{##7}%
476 \ifDTMshowzone
477 \DTMbasquetimezonesep
478 \DTMdisplayzone{##8}{##9}%
479 \fi
480 }%
481 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
482 }
483 % \end{macrocode}
484 %
485 %\begin{macro}{\DTMbasquezonemaps}
486 % The time zone mappings are set through this command, which can be
487 % redefined if extra mappings are required or mappings need to be
488 % removed. This currently has no mappings.
489 % \begin{macrocode}
490 \newcommand*{\DTMbasquezonemaps}{%
491 }
492 % \end{macrocode}
493 %\end{macro}
494
495 % Switch style according to the \opt{useregional} setting.
496 % \begin{macrocode}
497 \DTMifcaseregional
498 {}% do nothing
499 {\DTMsetstyle{basque}}
500 {\DTMsetstyle{basque-numeric}}
501 % \end{macrocode}
502 %
503 % Redefine \cs{datebasque} (or \cs{date}\meta{dialect}) to prevent
504 % \sty{babel} from resetting \cs{today}. (For this to work,
505 % \sty{babel} must already have been loaded if it's required.)
506 % \changes{v1.2a}{2018/03/20}{Suppress spurious space.}
507 % \begin{macrocode}
508 \ifcsundef{date\CurrentTrackedDialect}
509 {%
510 \ifundef\datebasque
511 {% do nothing
512 }%
513 {%
514 \def\datebasque{%
515 \DTMifcaseregional
516 {}% do nothing
517 {\DTMsetstyle{basque}}%
518 {\DTMsetstyle{basque-numeric}}%
519 }%
520 }%
521 }%
522 {%
523 \csdef{date\CurrentTrackedDialect}{%
524 \DTMifcaseregional
525 {}% do nothing
526 {\DTMsetstyle{basque}}%
527 {\DTMsetstyle{basque-numeric}}%
528 }%
529 }%
530 % \end{macrocode}
531 %\iffalse
532 % \begin{macrocode}
533 %</datetime2-basque.ldf>
534 % \end{macrocode}
535 %\fi
536 %\Finale
537 \endinput