Debian Codegraph @

texmf-dist/source/latex/datetime2-turkish/datetime2-turkish.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-2019 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 Turkish Module}]{hyperref}
37
38 \setmainfont{Liberation Serif}
39 \setmonofont{Liberation Mono}
40
41 \CheckSum{218}
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-turkish.dtx}
57 \end{document}
58 %</driver>
59 %\fi
60 %
61 %\MakeShortVerb{"}
62 %
63 %\title{Turkish Module for datetime2 Package}
64 %\author{Nicola L. C. Talbot (inactive)}
65 %\date{2019-10-10 (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 maintenance, contact me at
70 %\url{https://www.dickimaw-books.com/contact.html}
71 %
72 %\begin{abstract}
73 %This is the Turkish 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-turkish}'s \cs{today}.
86 %
87 %I don't know if these settings are correct as I can't speak Turkish.
88 %In particular, I don't know if the "turkish" 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-turkish.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-turkish-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-04-01}{Initial release}
121 % Identify module
122 % \begin{macrocode}
123 \ProvidesDateTimeModule{turkish-utf8}[2019/10/10 v1.1]
124 % \end{macrocode}
125 %\begin{macro}{\DTMturkishordinal}
126 % \begin{macrocode}
127 \newcommand*{\DTMturkishordinal}[1]{%
128 \number#1
129 }
130 % \end{macrocode}
131 %\end{macro}
132 %
133 %\begin{macro}{\DTMturkishmonthname}
134 % Turkish month names.
135 % \begin{macrocode}
136 \newcommand*{\DTMturkishmonthname}[1]{%
137 \ifcase#1
138 \or
139 Ocak%
140 \or
141 Şubat%
142 \or
143 Mart%
144 \or
145 Nisan%
146 \or
147 Mayıs%
148 \or
149 Haziran%
150 \or
151 Temmuz%
152 \or
153 Ağustos%
154 \or
155 Eylül%
156 \or
157 Ekim%
158 \or
159 Kasım%
160 \or
161 Aralık%
162 \fi
163 }
164 % \end{macrocode}
165 %\end{macro}
166 %
167 %If abbreviated dates are supported, short month names should be
168 %likewise provided.
169 %
170 %\iffalse
171 % \begin{macrocode}
172 %</datetime2-turkish-utf8.ldf>
173 % \end{macrocode}
174 %\fi
175 %\iffalse
176 % \begin{macrocode}
177 %<*datetime2-turkish-ascii.ldf>
178 % \end{macrocode}
179 %\fi
180 %\subsection{ASCII}
181 %This file contains the settings that use \LaTeX\ commands for
182 %non-ASCII characters. This should be input if neither XeLaTeX nor
183 %LuaLaTeX are used. Even if the user has loaded \sty{inputenc} with
184 %"utf8", this file should still be used not the
185 %\texttt{datetime2-turkish-utf8.ldf} file as the non-ASCII
186 %characters are made active in that situation and would need
187 %protecting against expansion.
188 %\changes{1.0}{2015-04-01}{Initial release}
189 % Identify module
190 % \begin{macrocode}
191 \ProvidesDateTimeModule{turkish-ascii}[2019/10/10 v1.1]
192 % \end{macrocode}
193 %
194 %If abbreviated dates are supported, short month names should be
195 %likewise provided.
196 %\begin{macro}{\DTMturkishordinal}
197 % \begin{macrocode}
198 \newcommand*{\DTMturkishordinal}[1]{%
199 \number#1
200 }
201 % \end{macrocode}
202 %\end{macro}
203 %
204 %\begin{macro}{\DTMturkishmonthname}
205 % Turkish month names.
206 % \begin{macrocode}
207 \newcommand*{\DTMturkishmonthname}[1]{%
208 \ifcase#1
209 \or
210 Ocak%
211 \or
212 \protect\c Subat%
213 \or
214 Mart%
215 \or
216 Nisan%
217 \or
218 May\protect\i s%
219 \or
220 Haziran%
221 \or
222 Temmuz%
223 \or
224 A\protect\u gustos%
225 \or
226 Eyl\protect\"ul%
227 \or
228 Ekim%
229 \or
230 Kas\protect\i m%
231 \or
232 Aral\protect\i k%
233 \fi
234 }
235 % \end{macrocode}
236 %\end{macro}
237 %
238 %
239 %\iffalse
240 % \begin{macrocode}
241 %</datetime2-turkish-ascii.ldf>
242 % \end{macrocode}
243 %\fi
244 %
245 %\subsection{Main Turkish Module (\texttt{datetime2-turkish.ldf})}
246 %\changes{1.0}{2015-04-01}{Initial release}
247 %
248 %\iffalse
249 % \begin{macrocode}
250 %<*datetime2-turkish.ldf>
251 % \end{macrocode}
252 %\fi
253 %
254 % Identify Module
255 % \begin{macrocode}
256 \ProvidesDateTimeModule{turkish}[2019/10/10 v1.1]
257 % \end{macrocode}
258 % Need to find out if XeTeX or LuaTeX are being used.
259 % \begin{macrocode}
260 \RequirePackage{ifxetex,ifluatex}
261 % \end{macrocode}
262 % XeTeX and LuaTeX natively support UTF-8, so load
263 % \texttt{turkish-utf8} if either of those engines are used
264 % otherwise load \texttt{turkish-ascii}.
265 % \begin{macrocode}
266 \ifxetex
267 \RequireDateTimeModule{turkish-utf8}
268 \else
269 \ifluatex
270 \RequireDateTimeModule{turkish-utf8}
271 \else
272 \RequireDateTimeModule{turkish-ascii}
273 \fi
274 \fi
275 % \end{macrocode}
276 %
277 % Define the \texttt{turkish} style.
278 % The time style is the same as the "default" style
279 % provided by \sty{datetime2}. This may need correcting. For
280 % example, if a 12 hour style similar to the "englishampm" (from the
281 % "english-base" module) is required.
282 %
283 % Allow the user a way of configuring the "turkish" and
284 % "turkish-numeric" styles. This doesn't use the package wide
285 % separators such as
286 % \cs{dtm@datetimesep} in case other date formats are also required.
287 %\begin{macro}{\DTMturkishdaymonthsep}
288 % The separator between the day and month for the text format.
289 % \begin{macrocode}
290 \newcommand*{\DTMturkishdaymonthsep}{%
291 \DTMtexorpdfstring{\protect~}{\space}}
292 % \end{macrocode}
293 %\end{macro}
294 %
295 %\begin{macro}{\DTMturkishmonthyearsep}
296 % The separator between the month and year for the text format.
297 % \begin{macrocode}
298 \newcommand*{\DTMturkishmonthyearsep}{\space}
299 % \end{macrocode}
300 %\end{macro}
301 %
302 %\begin{macro}{\DTMturkishdatetimesep}
303 % The separator between the date and time blocks in the full format
304 % (either text or numeric).
305 % \begin{macrocode}
306 \newcommand*{\DTMturkishdatetimesep}{\space}
307 % \end{macrocode}
308 %\end{macro}
309 %
310 %\begin{macro}{\DTMturkishtimezonesep}
311 % The separator between the time and zone blocks in the full format
312 % (either text or numeric).
313 % \begin{macrocode}
314 \newcommand*{\DTMturkishtimezonesep}{\space}
315 % \end{macrocode}
316 %\end{macro}
317 %
318 %\begin{macro}{\DTMturkishdatesep}
319 % The separator for the numeric date format.
320 % \begin{macrocode}
321 \newcommand*{\DTMturkishdatesep}{.}
322 % \end{macrocode}
323 %\end{macro}
324 %
325 %\begin{macro}{\DTMturkishtimesep}
326 % The separator for the numeric time format.
327 % \begin{macrocode}
328 \newcommand*{\DTMturkishtimesep}{:}
329 % \end{macrocode}
330 %\end{macro}
331 %
332 %Provide keys that can be used in \cs{DTMlangsetup} to set these
333 %separators.
334 % \begin{macrocode}
335 \DTMdefkey{turkish}{daymonthsep}{\renewcommand*{\DTMturkishdaymonthsep}{#1}}
336 \DTMdefkey{turkish}{monthyearsep}{\renewcommand*{\DTMturkishmonthyearsep}{#1}}
337 \DTMdefkey{turkish}{datetimesep}{\renewcommand*{\DTMturkishdatetimesep}{#1}}
338 \DTMdefkey{turkish}{timezonesep}{\renewcommand*{\DTMturkishtimezonesep}{#1}}
339 \DTMdefkey{turkish}{datesep}{\renewcommand*{\DTMturkishdatesep}{#1}}
340 \DTMdefkey{turkish}{timesep}{\renewcommand*{\DTMturkishtimesep}{#1}}
341 % \end{macrocode}
342 %
343 % TODO: provide a boolean key to switch between full and abbreviated
344 % formats if appropriate. (I don't know how the date should be
345 % abbreviated.)
346 %
347 % Define a boolean key that determines if the time zone mappings
348 % should be used.
349 % \begin{macrocode}
350 \DTMdefboolkey{turkish}{mapzone}[true]{}
351 % \end{macrocode}
352 % The default is to use mappings.
353 % \begin{macrocode}
354 \DTMsetbool{turkish}{mapzone}{true}
355 % \end{macrocode}
356 %
357 % Define a boolean key that determines if the day of month should be
358 % displayed.
359 % \begin{macrocode}
360 \DTMdefboolkey{turkish}{showdayofmonth}[true]{}
361 % \end{macrocode}
362 % The default is to show the day of month.
363 % \begin{macrocode}
364 \DTMsetbool{turkish}{showdayofmonth}{true}
365 % \end{macrocode}
366 %
367 % Define a boolean key that determines if the year should be
368 % displayed.
369 % \begin{macrocode}
370 \DTMdefboolkey{turkish}{showyear}[true]{}
371 % \end{macrocode}
372 % The default is to show the year.
373 % \begin{macrocode}
374 \DTMsetbool{turkish}{showyear}{true}
375 % \end{macrocode}
376 %
377 % Define the "turkish" style. (TODO: implement day of week?)
378 % \begin{macrocode}
379 \DTMnewstyle
380 {turkish}% label
381 {% date style
382 \renewcommand*\DTMdisplaydate[4]{%
383 \DTMifbool{turkish}{showdayofmonth}
384 {%
385 \DTMturkishordinal{##3}%
386 \DTMturkishdaymonthsep
387 }%
388 {}%
389 \DTMturkishmonthname{##2}%
390 \DTMifbool{turkish}{showyear}%
391 {%
392 \DTMturkishmonthyearsep
393 \number##1 % space intended
394 }%
395 {}%
396 }%
397 \renewcommand*\DTMDisplaydate{\DTMdisplaydate}%
398 }%
399 {% time style (use default)
400 \DTMsettimestyle{default}%
401 }%
402 {% zone style
403 \DTMresetzones
404 \DTMturkishzonemaps
405 \renewcommand*{\DTMdisplayzone}[2]{%
406 \DTMifbool{turkish}{mapzone}%
407 {\DTMusezonemapordefault{##1}{##2}}%
408 {%
409 \ifnum##1<0 \else+\fi\DTMtwodigits{##1}%
410 \ifDTMshowzoneminutes\DTMturkishtimesep\DTMtwodigits{##2}\fi
411 }%
412 }%
413 }%
414 {% full style
415 \renewcommand*{\DTMdisplay}[9]{%
416 \ifDTMshowdate
417 \DTMdisplaydate{##1}{##2}{##3}{##4}%
418 \DTMturkishdatetimesep
419 \fi
420 \DTMdisplaytime{##5}{##6}{##7}%
421 \ifDTMshowzone
422 \DTMturkishtimezonesep
423 \DTMdisplayzone{##8}{##9}%
424 \fi
425 }%
426 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
427 }%
428 % \end{macrocode}
429 %
430 % Define numeric style.
431 % \begin{macrocode}
432 \DTMnewstyle
433 {turkish-numeric}% label
434 {% date style
435 \renewcommand*\DTMdisplaydate[4]{%
436 \DTMifbool{turkish}{showdayofmonth}%
437 {%
438 \number##3 % space intended
439 \DTMturkishdatesep
440 }%
441 {}%
442 \number##2 % space intended
443 \DTMifbool{turkish}{showyear}%
444 {%
445 \DTMturkishdatesep
446 \number##1 % space intended
447 }%
448 {}%
449 }%
450 \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}%
451 }%
452 {% time style
453 \renewcommand*\DTMdisplaytime[3]{%
454 \number##1 % space intended
455 \DTMturkishtimesep\DTMtwodigits{##2}%
456 \ifDTMshowseconds\DTMturkishtimesep\DTMtwodigits{##3}\fi
457 }%
458 }%
459 {% zone style
460 \DTMresetzones
461 \DTMturkishzonemaps
462 \renewcommand*{\DTMdisplayzone}[2]{%
463 \DTMifbool{turkish}{mapzone}%
464 {\DTMusezonemapordefault{##1}{##2}}%
465 {%
466 \ifnum##1<0 \else+\fi\DTMtwodigits{##1}%
467 \ifDTMshowzoneminutes\DTMturkishtimesep\DTMtwodigits{##2}\fi
468 }%
469 }%
470 }%
471 {% full style
472 \renewcommand*{\DTMdisplay}[9]{%
473 \ifDTMshowdate
474 \DTMdisplaydate{##1}{##2}{##3}{##4}%
475 \DTMturkishdatetimesep
476 \fi
477 \DTMdisplaytime{##5}{##6}{##7}%
478 \ifDTMshowzone
479 \DTMturkishtimezonesep
480 \DTMdisplayzone{##8}{##9}%
481 \fi
482 }%
483 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
484 }
485 % \end{macrocode}
486 %
487 %\begin{macro}{\DTMturkishzonemaps}
488 % The time zone mappings are set through this command, which can be
489 % redefined if extra mappings are required or mappings need to be
490 % removed.
491 % \begin{macrocode}
492 \newcommand*{\DTMturkishzonemaps}{%
493 \DTMdefzonemap{02}{00}{EET}%
494 \DTMdefzonemap{03}{00}{EEST}%
495 }
496 % \end{macrocode}
497 %\end{macro}
498
499 % Switch style according to the \opt{useregional} setting.
500 % \begin{macrocode}
501 \DTMifcaseregional
502 {}% do nothing
503 {\DTMsetstyle{turkish}}
504 {\DTMsetstyle{turkish-numeric}}
505 % \end{macrocode}
506 %
507 % Redefine \cs{dateturkish} (or \cs{date}\meta{dialect}) to prevent
508 % \sty{babel} from resetting \cs{today}. (For this to work,
509 % \sty{babel} must already have been loaded if it's required.)
510 %\changes{1.1}{2019-10-10}{removed spurious space}
511 % \begin{macrocode}
512 \ifcsundef{date\CurrentTrackedDialect}
513 {%
514 \ifundef\dateturkish
515 {% do nothing
516 }%
517 {%
518 \def\dateturkish{%
519 \DTMifcaseregional
520 {}% do nothing
521 {\DTMsetstyle{turkish}}%
522 {\DTMsetstyle{turkish-numeric}}%
523 }%
524 }%
525 }%
526 {%
527 \csdef{date\CurrentTrackedDialect}{%
528 \DTMifcaseregional
529 {}% do nothing
530 {\DTMsetstyle{turkish}}%
531 {\DTMsetstyle{turkish-numeric}}%
532 }%
533 }%
534 % \end{macrocode}
535 %\iffalse
536 % \begin{macrocode}
537 %</datetime2-turkish.ldf>
538 % \end{macrocode}
539 %\fi
540 %\Finale
541 \endinput