1 /*
2  *   SPDX-FileCopyrightText: 2010 Petri Damstén <damu@iki.fi>
3  *   SPDX-FileCopyrightText: 2014 John Layt <jlayt@kde.org>
4  *   SPDX-FileCopyrightText: 2014 Garret Wassermann <gwasser@gmail.com>
5  *
6  *   SPDX-License-Identifier: LGPL-2.0-or-later
7  */
8 
9 #include "unit_p.h"
10 #include "voltage_p.h"
11 
12 #include <KLocalizedString>
13 
14 namespace KUnitConversion
15 {
Voltage()16 Voltage::Voltage()
17     : CustomCategory(VoltageCategory, i18n("Voltage"), i18n("Voltage"))
18 {
19     KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (voltage", "%1 %2");
20 
21     addUnit(CustomUnit(VoltageCategory,
22                        Yottavolts,
23                        1e+24,
24                        i18nc("voltage unit symbol", "YV"),
25                        i18nc("unit description in lists", "yottavolts"),
26                        i18nc("unit synonyms for matching user input", "yottavolt;yottavolts;YV"),
27                        symbolString,
28                        ki18nc("amount in units (real)", "%1 yottavolts"),
29                        ki18ncp("amount in units (integer)", "%1 yottavolt", "%1 yottavolts")));
30 
31     addUnit(CustomUnit(VoltageCategory,
32                        Zettavolts,
33                        1e+21,
34                        i18nc("voltage unit symbol", "ZV"),
35                        i18nc("unit description in lists", "zettavolts"),
36                        i18nc("unit synonyms for matching user input", "zettavolt;zettavolts;ZV"),
37                        symbolString,
38                        ki18nc("amount in units (real)", "%1 zettavolts"),
39                        ki18ncp("amount in units (integer)", "%1 zettavolt", "%1 zettavolts")));
40 
41     addUnit(CustomUnit(VoltageCategory,
42                        Exavolts,
43                        1e+18,
44                        i18nc("voltage unit symbol", "EV"),
45                        i18nc("unit description in lists", "exavolts"),
46                        i18nc("unit synonyms for matching user input", "exavolt;exavolts;EV"),
47                        symbolString,
48                        ki18nc("amount in units (real)", "%1 exavolts"),
49                        ki18ncp("amount in units (integer)", "%1 exavolt", "%1 exavolts")));
50 
51     addUnit(CustomUnit(VoltageCategory,
52                        Petavolts,
53                        1e+15,
54                        i18nc("voltage unit symbol", "PV"),
55                        i18nc("unit description in lists", "petavolts"),
56                        i18nc("unit synonyms for matching user input", "petavolt;petavolts;PV"),
57                        symbolString,
58                        ki18nc("amount in units (real)", "%1 petavolts"),
59                        ki18ncp("amount in units (integer)", "%1 petavolt", "%1 petavolts")));
60 
61     addUnit(CustomUnit(VoltageCategory,
62                        Teravolts,
63                        1e+12,
64                        i18nc("voltage unit symbol", "TV"),
65                        i18nc("unit description in lists", "teravolts"),
66                        i18nc("unit synonyms for matching user input", "teravolt;teravolts;TV"),
67                        symbolString,
68                        ki18nc("amount in units (real)", "%1 teravolts"),
69                        ki18ncp("amount in units (integer)", "%1 teravolt", "%1 teravolts")));
70 
71     addCommonUnit(CustomUnit(VoltageCategory,
72                              Gigavolts,
73                              1e+09,
74                              i18nc("voltage unit symbol", "GV"),
75                              i18nc("unit description in lists", "gigavolts"),
76                              i18nc("unit synonyms for matching user input", "gigavolt;gigavolts;GV"),
77                              symbolString,
78                              ki18nc("amount in units (real)", "%1 gigavolts"),
79                              ki18ncp("amount in units (integer)", "%1 gigavolt", "%1 gigavolts")));
80 
81     addCommonUnit(CustomUnit(VoltageCategory,
82                              Megavolts,
83                              1e+06,
84                              i18nc("voltage unit symbol", "MV"),
85                              i18nc("unit description in lists", "megavolts"),
86                              i18nc("unit synonyms for matching user input", "megavolt;megavolts;MV"),
87                              symbolString,
88                              ki18nc("amount in units (real)", "%1 megavolts"),
89                              ki18ncp("amount in units (integer)", "%1 megavolt", "%1 megavolts")));
90 
91     addCommonUnit(CustomUnit(VoltageCategory,
92                              Kilovolts,
93                              1000,
94                              i18nc("voltage unit symbol", "kV"),
95                              i18nc("unit description in lists", "kilovolts"),
96                              i18nc("unit synonyms for matching user input", "kilovolt;kilovolts;kV"),
97                              symbolString,
98                              ki18nc("amount in units (real)", "%1 kilovolts"),
99                              ki18ncp("amount in units (integer)", "%1 kilovolt", "%1 kilovolts")));
100 
101     addUnit(CustomUnit(VoltageCategory,
102                        Hectovolts,
103                        100,
104                        i18nc("voltage unit symbol", "hV"),
105                        i18nc("unit description in lists", "hectovolts"),
106                        i18nc("unit synonyms for matching user input", "hectovolt;hectovolts;hV"),
107                        symbolString,
108                        ki18nc("amount in units (real)", "%1 hectovolts"),
109                        ki18ncp("amount in units (integer)", "%1 hectovolt", "%1 hectovolts")));
110 
111     addUnit(CustomUnit(VoltageCategory,
112                        Decavolts,
113                        10,
114                        i18nc("voltage unit symbol", "daV"),
115                        i18nc("unit description in lists", "decavolts"),
116                        i18nc("unit synonyms for matching user input", "decavolt;decavolts;daV"),
117                        symbolString,
118                        ki18nc("amount in units (real)", "%1 decavolts"),
119                        ki18ncp("amount in units (integer)", "%1 decavolt", "%1 decavolts")));
120 
121     addDefaultUnit(CustomUnit(VoltageCategory,
122                               Volts,
123                               1,
124                               i18nc("voltage unit symbol", "V"),
125                               i18nc("unit description in lists", "volts"),
126                               i18nc("unit synonyms for matching user input", "volt;volts;V"),
127                               symbolString,
128                               ki18nc("amount in units (real)", "%1 volts"),
129                               ki18ncp("amount in units (integer)", "%1 volt", "%1 volts")));
130 
131     addUnit(CustomUnit(VoltageCategory,
132                        Decivolts,
133                        0.1,
134                        i18nc("voltage unit symbol", "dV"),
135                        i18nc("unit description in lists", "decivolts"),
136                        i18nc("unit synonyms for matching user input", "decivolt;decivolts;dV"),
137                        symbolString,
138                        ki18nc("amount in units (real)", "%1 decivolts"),
139                        ki18ncp("amount in units (integer)", "%1 decivolt", "%1 decivolts")));
140 
141     addUnit(CustomUnit(VoltageCategory,
142                        Centivolts,
143                        0.01,
144                        i18nc("voltage unit symbol", "cV"),
145                        i18nc("unit description in lists", "centivolts"),
146                        i18nc("unit synonyms for matching user input", "centivolt;centivolts;cV"),
147                        symbolString,
148                        ki18nc("amount in units (real)", "%1 centivolts"),
149                        ki18ncp("amount in units (integer)", "%1 centivolt", "%1 centivolts")));
150 
151     addUnit(CustomUnit(VoltageCategory,
152                        Millivolts,
153                        0.001,
154                        i18nc("voltage unit symbol", "mV"),
155                        i18nc("unit description in lists", "millivolts"),
156                        i18nc("unit synonyms for matching user input", "millivolt;millivolts;mV"),
157                        symbolString,
158                        ki18nc("amount in units (real)", "%1 millivolts"),
159                        ki18ncp("amount in units (integer)", "%1 millivolt", "%1 millivolts")));
160 
161     addUnit(CustomUnit(VoltageCategory,
162                        Microvolts,
163                        1e-06,
164                        i18nc("voltage unit symbol", "µV"),
165                        i18nc("unit description in lists", "microvolts"),
166                        i18nc("unit synonyms for matching user input", "microvolt;microvolts;µV;uV"),
167                        symbolString,
168                        ki18nc("amount in units (real)", "%1 microvolts"),
169                        ki18ncp("amount in units (integer)", "%1 microvolt", "%1 microvolts")));
170 
171     addUnit(CustomUnit(VoltageCategory,
172                        Nanovolts,
173                        1e-09,
174                        i18nc("voltage unit symbol", "nV"),
175                        i18nc("unit description in lists", "nanovolts"),
176                        i18nc("unit synonyms for matching user input", "nanovolt;nanovolts;nV"),
177                        symbolString,
178                        ki18nc("amount in units (real)", "%1 nanovolts"),
179                        ki18ncp("amount in units (integer)", "%1 nanovolt", "%1 nanovolts")));
180 
181     addUnit(CustomUnit(VoltageCategory,
182                        Picovolts,
183                        1e-12,
184                        i18nc("voltage unit symbol", "pV"),
185                        i18nc("unit description in lists", "picovolts"),
186                        i18nc("unit synonyms for matching user input", "picovolt;picovolts;pV"),
187                        symbolString,
188                        ki18nc("amount in units (real)", "%1 picovolts"),
189                        ki18ncp("amount in units (integer)", "%1 picovolt", "%1 picovolts")));
190 
191     addUnit(CustomUnit(VoltageCategory,
192                        Femtovolts,
193                        1e-15,
194                        i18nc("voltage unit symbol", "fV"),
195                        i18nc("unit description in lists", "femtovolts"),
196                        i18nc("unit synonyms for matching user input", "femtovolt;femtovolts;fV"),
197                        symbolString,
198                        ki18nc("amount in units (real)", "%1 femtovolts"),
199                        ki18ncp("amount in units (integer)", "%1 femtovolt", "%1 femtovolts")));
200 
201     addUnit(CustomUnit(VoltageCategory,
202                        Attovolts,
203                        1e-18,
204                        i18nc("voltage unit symbol", "aV"),
205                        i18nc("unit description in lists", "attovolts"),
206                        i18nc("unit synonyms for matching user input", "attovolt;attovolts;aV"),
207                        symbolString,
208                        ki18nc("amount in units (real)", "%1 attovolts"),
209                        ki18ncp("amount in units (integer)", "%1 attovolt", "%1 attovolts")));
210 
211     addUnit(CustomUnit(VoltageCategory,
212                        Zeptovolts,
213                        1e-21,
214                        i18nc("voltage unit symbol", "zV"),
215                        i18nc("unit description in lists", "zeptovolts"),
216                        i18nc("unit synonyms for matching user input", "zeptovolt;zeptovolts;zV"),
217                        symbolString,
218                        ki18nc("amount in units (real)", "%1 zeptovolts"),
219                        ki18ncp("amount in units (integer)", "%1 zeptovolt", "%1 zeptovolts")));
220 
221     addUnit(CustomUnit(VoltageCategory,
222                        Yoctovolts,
223                        1e-24,
224                        i18nc("voltage unit symbol", "yV"),
225                        i18nc("unit description in lists", "yoctovolts"),
226                        i18nc("unit synonyms for matching user input", "yoctovolt;yoctovolts;yV"),
227                        symbolString,
228                        ki18nc("amount in units (real)", "%1 yoctovolts"),
229                        ki18ncp("amount in units (integer)", "%1 yoctovolt", "%1 yoctovolts")));
230 
231     addUnit(CustomUnit(VoltageCategory,
232                        Statvolts,
233                        299.792458,
234                        i18nc("voltage unit symbol", "stV"),
235                        i18nc("unit description in lists", "statvolts"),
236                        i18nc("unit synonyms for matching user input", "statvolt;statvolts;stV"),
237                        symbolString,
238                        ki18nc("amount in units (real)", "%1 statvolts"),
239                        ki18ncp("amount in units (integer)", "%1 statvolt", "%1 statvolts")));
240 }
241 
242 } // KUnitConversion namespace
243