forked from josephwright/siunitx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
siunitx-locale.dtx
141 lines (141 loc) · 3.67 KB
/
siunitx-locale.dtx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
% \iffalse meta-comment
%
% File: siunitx-locale.dtx Copyright (C) 2020 Joseph Wright
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version. The latest version
% of this license is in the file
%
% https://www.latex-project.org/lppl.txt
%
% This file is part of the "siunitx bundle" (The Work in LPPL)
% and all files in that bundle must be distributed together.
%
% The released version of this bundle is available from CTAN.
%
% -----------------------------------------------------------------------
%
% The development version of the bundle can be found at
%
% https://github.com/josephwright/siunitx
%
% for those people who are interested.
%
% -----------------------------------------------------------------------
%
%<*driver>
\documentclass{l3doc}
% The next line is needed so that \GetFileInfo will be able to pick up
% version data
\usepackage{siunitx}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{siunitx.sty}
%
% \title{^^A
% \pkg{siunitx-locale} -- Localisation^^A
% \thanks{This file describes \fileversion,
% last revised \filedate.}^^A
% }
%
% \author{^^A
% Joseph Wright^^A
% \thanks{^^A
% E-mail:
% \href{mailto:joseph.wright@morningstar2.co.uk}
% {joseph.wright@morningstar2.co.uk}^^A
% }^^A
% }
%
% \date{Released \filedate}
%
% \maketitle
%
% \begin{documentation}
%
% \end{documentation}
%
% \begin{implementation}
%
% \section{\pkg{siunitx-locale} implementation}
%
% Start the \pkg{DocStrip} guards.
% \begin{macrocode}
%<*package>
% \end{macrocode}
%
% Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention): only
% internal material in this \emph{submodule} should be used directly.
% \begin{macrocode}
%<@@=siunitx_locale>
% \end{macrocode}
%
% \subsection{Locales}
%
% The basics for defining locales are easy: these are just meta keys.
% \begin{macrocode}
\keys_define:nn { siunitx }
{
locale .choice: ,
locale / DE .meta:n =
{
exponent-product = \cdot ,
inter-unit-product = \, ,
output-decimal-marker = { , }
} ,
locale / FR .meta:n =
{
exponent-product = \times ,
inter-unit-product = \, ,
output-decimal-marker = { , }
} ,
locale / UK .meta:n =
{
exponent-product = \times ,
inter-unit-product = \, ,
output-decimal-marker = .
},
locale / US .meta:n =
{
exponent-product = \times ,
inter-unit-product = \, ,
output-decimal-marker = .
} ,
locale / ZA .meta:n =
{
exponent-product = \times ,
inter-unit-product = \cdot ,
output-decimal-marker = { , }
}
}
% \end{macrocode}
%
% \subsection{Localisation}
%
% Localisation makes use of the \pkg{translator} package. This only happens
% if it is available, and is transparent to the user.
% \begin{macrocode}
\file_if_exist:nT { translations.sty }
{
\RequirePackage { translations }
\DeclareTranslation { English } { to~(numerical~range) } { to }
\DeclareTranslation { French } { to~(numerical~range) } { \'{a} }
\DeclareTranslation { German } { to~(numerical~range) } { bis }
\DeclareTranslation { Spanish } { to~(numerical~range) } { a }
\keys_set:nn { siunitx }
{
list-final-separator = { ~ \GetTranslation { and } ~ },
list-pair-separator = { ~ \GetTranslation { and } ~ },
range-phrase = { ~ \GetTranslation { to~(numerical~range) } ~ }
}
}
% \end{macrocode}
%
% \end{implementation}
%
% \PrintIndex