Debian Codegraph @

texmf-dist/source/latex/datetime2-german/datetime2-de-CH.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 %
20 % Doc-Source file to use with LaTeX2e
21 % Copyright (C) 2015 Nicola Talbot, all rights reserved.
22 % Copyright (C) 2017-19 Sebastian Friedl, all rights reserved.
23 % \fi
24 %
25 %
26 %
27 % \subsection{Swiss German (de-CH): \texttt{datetime2-de-CH.ldf}}
28 % \changes{2.0}{2017-10-03}{Added regional variant: Swiss German (de-CH)}
29 %
30 % Identify Module.
31 % \begin{macrocode}
32 \ProvidesDateTimeModule{de-CH}[2019/12/13 v3.0]
33 % \end{macrocode}
34 % Require the base German module
35 % \begin{macrocode}
36 \RequireDateTimeModule{german-base}
37 % \end{macrocode}
38 %
39 %
40 % Allow the user to configure the "de-CH" and "de-CH-numeric" styles.
41 % The package wide separators such as \cs{dtm@datetimesep} are not used
42 % in case other date formats are also required.
43 %
44 %\begin{macro}{\DTMdeCHdowdaysep}
45 % The separator between weekday and day
46 % \begin{macrocode}
47 \newcommand*{\DTMdeCHdowdaysep}{,\space}
48 % \end{macrocode}
49 %\end{macro}
50 %
51 %\begin{macro}{\DTMdeCHdaymonthsep}
52 % The separator between the day and month for the text format.
53 % \begin{macrocode}
54 \newcommand*{\DTMdeCHdaymonthsep}{.\DTMtexorpdfstring{\protect~}{\space}}
55 % \end{macrocode}
56 %\end{macro}
57 %
58 %\begin{macro}{\DTMdeCHmonthyearsep}
59 % The separator between the month and year for the text format.
60 % \begin{macrocode}
61 \newcommand*{\DTMdeCHmonthyearsep}{\space}
62 % \end{macrocode}
63 %\end{macro}
64 %
65 %\begin{macro}{\DTMdeCHdatetimesep}
66 % The separator between the date and time blocks in the full format
67 % (either text or numeric).
68 % \begin{macrocode}
69 \newcommand*{\DTMdeCHdatetimesep}{,\space}
70 % \end{macrocode}
71 %\end{macro}
72 %
73 %\begin{macro}{\DTMdeCHtimezonesep}
74 % The separator between the time and zone blocks in the full format
75 % (either text or numeric).
76 % \begin{macrocode}
77 \newcommand*{\DTMdeCHtimezonesep}{\space}
78 % \end{macrocode}
79 %\end{macro}
80 %
81 %\begin{macro}{\DTMdeCHdatesep}
82 % The separator for the numeric date format.
83 % \begin{macrocode}
84 \newcommand*{\DTMdeCHdatesep}{.}
85 % \end{macrocode}
86 %\end{macro}
87 %
88 %\begin{macro}{\DTMdeCHtimesep}
89 % The separator for the numeric time format.
90 % \begin{macrocode}
91 \newcommand*{\DTMdeCHtimesep}{.}
92 % \end{macrocode}
93 %\end{macro}
94 %
95 % Provide keys that can be used in \cs{DTMlangsetup} to set these
96 % separators.
97 % \begin{macrocode}
98 \DTMdefkey{de-CH}{dowdaysep}{\renewcommand*{\DTMdeCHdowdaysep}{#1}}
99 \DTMdefkey{de-CH}{daymonthsep}{\renewcommand*{\DTMdeCHdaymonthsep}{#1}}
100 \DTMdefkey{de-CH}{monthyearsep}{\renewcommand*{\DTMdeCHmonthyearsep}{#1}}
101 \DTMdefkey{de-CH}{datetimesep}{\renewcommand*{\DTMdeCHdatetimesep}{#1}}
102 \DTMdefkey{de-CH}{timezonesep}{\renewcommand*{\DTMdeCHtimezonesep}{#1}}
103 \DTMdefkey{de-CH}{datesep}{\renewcommand*{\DTMdeCHdatesep}{#1}}
104 \DTMdefkey{de-CH}{timesep}{\renewcommand*{\DTMdeCHtimesep}{#1}}
105 % \end{macrocode}
106 %
107 %
108 % Define a boolean key that can switch between full and abbreviated formats for
109 % the month and day of week names.
110 % \begin{macrocode}
111 \DTMdefboolkey{de-CH}{abbr}[true]{}
112 % \end{macrocode}
113 %
114 % The default is to show the full name.
115 % \begin{macrocode}
116 \DTMsetbool{de-CH}{abbr}{false}
117 % \end{macrocode}
118 %
119 % Define a boolean key that determines if the time zone mappings
120 % should be used.
121 % \begin{macrocode}
122 \DTMdefboolkey{de-CH}{mapzone}[true]{}
123 % \end{macrocode}
124 % The default is to use mappings.
125 % \begin{macrocode}
126 \DTMsetbool{de-CH}{mapzone}{true}
127 % \end{macrocode}
128 %
129 % Define a boolean key that determines if the day of month should be
130 % displayed.
131 % \begin{macrocode}
132 \DTMdefboolkey{de-CH}{showdayofmonth}[true]{}
133 % \end{macrocode}
134 % The default is to show the day of month.
135 % \begin{macrocode}
136 \DTMsetbool{de-CH}{showdayofmonth}{true}
137 % \end{macrocode}
138 %
139 % Define a boolean key that determines if the year should be
140 % displayed.
141 % \begin{macrocode}
142 \DTMdefboolkey{de-CH}{showyear}[true]{}
143 % \end{macrocode}
144 % The default is to show the year.
145 % \begin{macrocode}
146 \DTMsetbool{de-CH}{showyear}{true}
147 % \end{macrocode}
148 %
149 %
150 % Define the "de-CH" style.
151 % \begin{macrocode}
152 \DTMnewstyle
153 {de-CH}% label
154 {% date style
155 \renewcommand*\DTMdisplaydate[4]{%
156 \ifDTMshowdow
157 \ifnum##4>-1
158 \DTMifbool{de-CH}{abbr}%
159 {\DTMgermanshortweekdayname{##4}}%
160 {\DTMgermanweekdayname{##4}}%
161 \DTMdeCHdowdaysep
162 \fi
163 \fi
164 %
165 \DTMifbool{de-CH}{showdayofmonth}%
166 {\DTMgermanordinal{##3}\DTMdeCHdaymonthsep}%
167 {}%
168 %
169 \DTMifbool{de-CH}{abbr}%
170 {\DTMdeCHshortmonthname{##2}}%
171 {\DTMgermanmonthname{##2}}%
172 %
173 \DTMifbool{de-CH}{showyear}%
174 {%
175 \DTMdeCHmonthyearsep%
176 \number##1 % space intended
177 }%
178 {}%
179 }%
180 \renewcommand*\DTMDisplaydate[4]{%
181 \ifDTMshowdow
182 \ifnum##4>-1
183 \DTMifbool{de-CH}{abbr}%
184 {\DTMgermanshortweekdayname{##4}}%
185 {\DTMgermanweekdayname{##4}}%
186 \DTMdeCHdowdaysep
187 \fi
188 \fi
189 %
190 \DTMifbool{de-CH}{showdayofmonth}%
191 {\DTMgermanordinal{##3}\DTMdeCHdaymonthsep}%
192 {}%
193 %
194 \DTMifbool{de-CH}{abbr}%
195 {\DTMdeCHshortmonthname{##2}}%
196 {\DTMgermanmonthname{##2}}%
197 %
198 \DTMifbool{de-CH}{showyear}%
199 {%
200 \DTMdeCHmonthyearsep%
201 \number##1 % space intended
202 }%
203 {}%
204 }
205 }%
206 {% time style (use default)
207 \renewcommand*\DTMdisplaytime[3]{%
208 \DTMtwodigits{##1}%
209 \DTMdeCHtimesep\DTMtwodigits{##2}%
210 \ifDTMshowseconds\DTMdeCHtimesep\DTMtwodigits{##3}\fi\space%
211 Uhr%
212 }%
213 }%
214 {% zone style
215 \DTMresetzones
216 \DTMgermanzonemaps
217 \renewcommand*{\DTMdisplayzone}[2]{%
218 \DTMifbool{de-CH}{mapzone}%
219 {\DTMusezonemapordefault{##1}{##2}}%
220 {%
221 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
222 \ifDTMshowzoneminutes\DTMdeCHtimesep\DTMtwodigits{##2}\fi
223 }%
224 }%
225 }%
226 {% full style
227 \renewcommand*{\DTMdisplay}[9]{%
228 \ifDTMshowdate
229 \DTMdisplaydate{##1}{##2}{##3}{##4}%
230 \DTMdeCHdatetimesep
231 \fi
232 \DTMdisplaytime{##5}{##6}{##7}%
233 \ifDTMshowzone
234 \DTMdeCHtimezonesep
235 \DTMdisplayzone{##8}{##9}%
236 \fi
237 }%
238 \renewcommand*{\DTMDisplay}[9]{%
239 \ifDTMshowdate
240 \DTMDisplaydate{##1}{##2}{##3}{##4}%
241 \DTMdeCHdatetimesep
242 \fi
243 \DTMdisplaytime{##5}{##6}{##7}%
244 \ifDTMshowzone
245 \DTMdeCHtimezonesep
246 \DTMdisplayzone{##8}{##9}%
247 \fi
248 }%
249 }%
250 % \end{macrocode}
251 %
252 % Define the corresponding numeric style.
253 % \begin{macrocode}
254 \DTMnewstyle
255 {de-CH-numeric}% label
256 {% date style
257 \renewcommand*\DTMdisplaydate[4]{%
258 \ifDTMshowdow
259 \ifnum##4>-1
260 \DTMifbool{de-CH}{abbr}%
261 {\DTMgermanshortweekdayname{##4}}%
262 {\DTMgermanweekdayname{##4}}%
263 \DTMdeCHdowdaysep
264 \fi
265 \fi
266 %
267 \DTMifbool{de-CH}{showdayofmonth}%
268 {%
269 \DTMtwodigits{##3}%
270 \DTMdeCHdatesep
271 }%
272 {}%
273 \DTMtwodigits{##2}%
274 \DTMdeCHdatesep%
275 \DTMifbool{de-CH}{showyear}%
276 {%
277 \DTMifbool{de-CH}{abbr}%
278 {\DTMtwodigits{##1}}%
279 {\number##1 }% space intended
280 }%
281 {}%
282 }%
283 \renewcommand*{\DTMDisplaydate}[4]{\DTMdisplaydate{##1}{##2}{##3}{##4}}%
284 }%
285 {% time style
286 \renewcommand*\DTMdisplaytime[3]{%
287 \DTMtwodigits{##1}%
288 \DTMdeCHtimesep\DTMtwodigits{##2}%
289 \ifDTMshowseconds\DTMdeCHtimesep\DTMtwodigits{##3}\fi\space%
290 Uhr%
291 }%
292 }%
293 {% zone style
294 \DTMresetzones
295 \DTMgermanzonemaps
296 \renewcommand*{\DTMdisplayzone}[2]{%
297 \DTMifbool{de-CH}{mapzone}%
298 {\DTMusezonemapordefault{##1}{##2}}%
299 {%
300 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
301 \ifDTMshowzoneminutes\DTMgermantimesep\DTMtwodigits{##2}\fi
302 }%
303 }%
304 }%
305 {% full style
306 \renewcommand*{\DTMdisplay}[9]{%
307 \ifDTMshowdate
308 \DTMdisplaydate{##1}{##2}{##3}{##4}%
309 \DTMdeCHdatetimesep
310 \fi
311 \DTMdisplaytime{##5}{##6}{##7}%
312 \ifDTMshowzone
313 \DTMdeCHtimezonesep
314 \DTMdisplayzone{##8}{##9}%
315 \fi
316 }%
317 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
318 }
319 % \end{macrocode}
320 %
321 % Switch the style according to the \opt{useregional} setting.
322 % \begin{macrocode}
323 \DTMifcaseregional
324 {}% do nothing
325 {\DTMsetstyle{de-CH}}%
326 {\DTMsetstyle{de-CH-numeric}}%
327 % \end{macrocode}
328 %
329 % Redefine \cs{dategerman} (or \cs{date}\meta{dialect}) to prevent
330 % \sty{babel} from resetting \cs{today}. (For this to work,
331 % \sty{babel} must already have been loaded if it's required.)
332 % \begin{macrocode}
333 \ifcsundef{date\CurrentTrackedDialect}
334 {%
335 \ifundef\dategerman
336 {}% do nothing
337 {%
338 \def\dategerman{%
339 \DTMifcaseregional
340 {}% do nothing
341 {\DTMsetstyle{de-CH}}%
342 {\DTMsetstyle{de-CH-numeric}}%
343 }%
344 }%
345 }%
346 {%
347 \csdef{date\CurrentTrackedDialect}{%
348 \DTMifcaseregional
349 {}% do nothing
350 {\DTMsetstyle{de-CH}}%
351 {\DTMsetstyle{de-CH-numeric}}%
352 }%
353 }%
354 % \end{macrocode}
355 %
356 \endinput