KUnitConversion

voltage.cpp
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
14namespace KUnitConversion
15{
16UnitCategory Voltage::makeCategory()
17{
18 auto c = UnitCategoryPrivate::makeCategory(VoltageCategory, i18n("Voltage"), i18n("Voltage"));
19 auto d = UnitCategoryPrivate::get(c);
20 KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (voltage", "%1 %2");
21
22 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
23 Yottavolts,
24 1e+24,
25 i18nc("voltage unit symbol", "YV"),
26 i18nc("unit description in lists", "yottavolts"),
27 i18nc("unit synonyms for matching user input", "yottavolt;yottavolts;YV"),
28 symbolString,
29 ki18nc("amount in units (real)", "%1 yottavolts"),
30 ki18ncp("amount in units (integer)", "%1 yottavolt", "%1 yottavolts")));
31
32 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
33 Zettavolts,
34 1e+21,
35 i18nc("voltage unit symbol", "ZV"),
36 i18nc("unit description in lists", "zettavolts"),
37 i18nc("unit synonyms for matching user input", "zettavolt;zettavolts;ZV"),
38 symbolString,
39 ki18nc("amount in units (real)", "%1 zettavolts"),
40 ki18ncp("amount in units (integer)", "%1 zettavolt", "%1 zettavolts")));
41
42 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
43 Exavolts,
44 1e+18,
45 i18nc("voltage unit symbol", "EV"),
46 i18nc("unit description in lists", "exavolts"),
47 i18nc("unit synonyms for matching user input", "exavolt;exavolts;EV"),
48 symbolString,
49 ki18nc("amount in units (real)", "%1 exavolts"),
50 ki18ncp("amount in units (integer)", "%1 exavolt", "%1 exavolts")));
51
52 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
53 Petavolts,
54 1e+15,
55 i18nc("voltage unit symbol", "PV"),
56 i18nc("unit description in lists", "petavolts"),
57 i18nc("unit synonyms for matching user input", "petavolt;petavolts;PV"),
58 symbolString,
59 ki18nc("amount in units (real)", "%1 petavolts"),
60 ki18ncp("amount in units (integer)", "%1 petavolt", "%1 petavolts")));
61
62 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
63 Teravolts,
64 1e+12,
65 i18nc("voltage unit symbol", "TV"),
66 i18nc("unit description in lists", "teravolts"),
67 i18nc("unit synonyms for matching user input", "teravolt;teravolts;TV"),
68 symbolString,
69 ki18nc("amount in units (real)", "%1 teravolts"),
70 ki18ncp("amount in units (integer)", "%1 teravolt", "%1 teravolts")));
71
72 d->addCommonUnit(UnitPrivate::makeUnit(VoltageCategory,
73 Gigavolts,
74 1e+09,
75 i18nc("voltage unit symbol", "GV"),
76 i18nc("unit description in lists", "gigavolts"),
77 i18nc("unit synonyms for matching user input", "gigavolt;gigavolts;GV"),
78 symbolString,
79 ki18nc("amount in units (real)", "%1 gigavolts"),
80 ki18ncp("amount in units (integer)", "%1 gigavolt", "%1 gigavolts")));
81
82 d->addCommonUnit(UnitPrivate::makeUnit(VoltageCategory,
83 Megavolts,
84 1e+06,
85 i18nc("voltage unit symbol", "MV"),
86 i18nc("unit description in lists", "megavolts"),
87 i18nc("unit synonyms for matching user input", "megavolt;megavolts;MV"),
88 symbolString,
89 ki18nc("amount in units (real)", "%1 megavolts"),
90 ki18ncp("amount in units (integer)", "%1 megavolt", "%1 megavolts")));
91
92 d->addCommonUnit(UnitPrivate::makeUnit(VoltageCategory,
93 Kilovolts,
94 1000,
95 i18nc("voltage unit symbol", "kV"),
96 i18nc("unit description in lists", "kilovolts"),
97 i18nc("unit synonyms for matching user input", "kilovolt;kilovolts;kV"),
98 symbolString,
99 ki18nc("amount in units (real)", "%1 kilovolts"),
100 ki18ncp("amount in units (integer)", "%1 kilovolt", "%1 kilovolts")));
101
102 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
103 Hectovolts,
104 100,
105 i18nc("voltage unit symbol", "hV"),
106 i18nc("unit description in lists", "hectovolts"),
107 i18nc("unit synonyms for matching user input", "hectovolt;hectovolts;hV"),
108 symbolString,
109 ki18nc("amount in units (real)", "%1 hectovolts"),
110 ki18ncp("amount in units (integer)", "%1 hectovolt", "%1 hectovolts")));
111
112 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
113 Decavolts,
114 10,
115 i18nc("voltage unit symbol", "daV"),
116 i18nc("unit description in lists", "decavolts"),
117 i18nc("unit synonyms for matching user input", "decavolt;decavolts;daV"),
118 symbolString,
119 ki18nc("amount in units (real)", "%1 decavolts"),
120 ki18ncp("amount in units (integer)", "%1 decavolt", "%1 decavolts")));
121
122 d->addDefaultUnit(UnitPrivate::makeUnit(VoltageCategory,
123 Volts,
124 1,
125 i18nc("voltage unit symbol", "V"),
126 i18nc("unit description in lists", "volts"),
127 i18nc("unit synonyms for matching user input", "volt;volts;V"),
128 symbolString,
129 ki18nc("amount in units (real)", "%1 volts"),
130 ki18ncp("amount in units (integer)", "%1 volt", "%1 volts")));
131
132 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
133 Decivolts,
134 0.1,
135 i18nc("voltage unit symbol", "dV"),
136 i18nc("unit description in lists", "decivolts"),
137 i18nc("unit synonyms for matching user input", "decivolt;decivolts;dV"),
138 symbolString,
139 ki18nc("amount in units (real)", "%1 decivolts"),
140 ki18ncp("amount in units (integer)", "%1 decivolt", "%1 decivolts")));
141
142 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
143 Centivolts,
144 0.01,
145 i18nc("voltage unit symbol", "cV"),
146 i18nc("unit description in lists", "centivolts"),
147 i18nc("unit synonyms for matching user input", "centivolt;centivolts;cV"),
148 symbolString,
149 ki18nc("amount in units (real)", "%1 centivolts"),
150 ki18ncp("amount in units (integer)", "%1 centivolt", "%1 centivolts")));
151
152 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
153 Millivolts,
154 0.001,
155 i18nc("voltage unit symbol", "mV"),
156 i18nc("unit description in lists", "millivolts"),
157 i18nc("unit synonyms for matching user input", "millivolt;millivolts;mV"),
158 symbolString,
159 ki18nc("amount in units (real)", "%1 millivolts"),
160 ki18ncp("amount in units (integer)", "%1 millivolt", "%1 millivolts")));
161
162 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
163 Microvolts,
164 1e-06,
165 i18nc("voltage unit symbol", "µV"),
166 i18nc("unit description in lists", "microvolts"),
167 i18nc("unit synonyms for matching user input", "microvolt;microvolts;µV;uV"),
168 symbolString,
169 ki18nc("amount in units (real)", "%1 microvolts"),
170 ki18ncp("amount in units (integer)", "%1 microvolt", "%1 microvolts")));
171
172 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
173 Nanovolts,
174 1e-09,
175 i18nc("voltage unit symbol", "nV"),
176 i18nc("unit description in lists", "nanovolts"),
177 i18nc("unit synonyms for matching user input", "nanovolt;nanovolts;nV"),
178 symbolString,
179 ki18nc("amount in units (real)", "%1 nanovolts"),
180 ki18ncp("amount in units (integer)", "%1 nanovolt", "%1 nanovolts")));
181
182 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
183 Picovolts,
184 1e-12,
185 i18nc("voltage unit symbol", "pV"),
186 i18nc("unit description in lists", "picovolts"),
187 i18nc("unit synonyms for matching user input", "picovolt;picovolts;pV"),
188 symbolString,
189 ki18nc("amount in units (real)", "%1 picovolts"),
190 ki18ncp("amount in units (integer)", "%1 picovolt", "%1 picovolts")));
191
192 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
193 Femtovolts,
194 1e-15,
195 i18nc("voltage unit symbol", "fV"),
196 i18nc("unit description in lists", "femtovolts"),
197 i18nc("unit synonyms for matching user input", "femtovolt;femtovolts;fV"),
198 symbolString,
199 ki18nc("amount in units (real)", "%1 femtovolts"),
200 ki18ncp("amount in units (integer)", "%1 femtovolt", "%1 femtovolts")));
201
202 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
203 Attovolts,
204 1e-18,
205 i18nc("voltage unit symbol", "aV"),
206 i18nc("unit description in lists", "attovolts"),
207 i18nc("unit synonyms for matching user input", "attovolt;attovolts;aV"),
208 symbolString,
209 ki18nc("amount in units (real)", "%1 attovolts"),
210 ki18ncp("amount in units (integer)", "%1 attovolt", "%1 attovolts")));
211
212 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
213 Zeptovolts,
214 1e-21,
215 i18nc("voltage unit symbol", "zV"),
216 i18nc("unit description in lists", "zeptovolts"),
217 i18nc("unit synonyms for matching user input", "zeptovolt;zeptovolts;zV"),
218 symbolString,
219 ki18nc("amount in units (real)", "%1 zeptovolts"),
220 ki18ncp("amount in units (integer)", "%1 zeptovolt", "%1 zeptovolts")));
221
222 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
223 Yoctovolts,
224 1e-24,
225 i18nc("voltage unit symbol", "yV"),
226 i18nc("unit description in lists", "yoctovolts"),
227 i18nc("unit synonyms for matching user input", "yoctovolt;yoctovolts;yV"),
228 symbolString,
229 ki18nc("amount in units (real)", "%1 yoctovolts"),
230 ki18ncp("amount in units (integer)", "%1 yoctovolt", "%1 yoctovolts")));
231
232 d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
233 Statvolts,
234 299.792458,
235 i18nc("voltage unit symbol", "stV"),
236 i18nc("unit description in lists", "statvolts"),
237 i18nc("unit synonyms for matching user input", "statvolt;statvolts;stV"),
238 symbolString,
239 ki18nc("amount in units (real)", "%1 statvolts"),
240 ki18ncp("amount in units (integer)", "%1 statvolt", "%1 statvolts")));
241
242 return c;
243}
244
245} // KUnitConversion namespace
QString i18nc(const char *context, const char *text, const TYPE &arg...)
KLocalizedString KI18N_EXPORT ki18ncp(const char *context, const char *singular, const char *plural)
KLocalizedString KI18N_EXPORT ki18nc(const char *context, const char *text)
QString i18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.