KUnitConversion

frequency.cpp
1/*
2 * SPDX-FileCopyrightText: 2010 Petri Damstén <damu@iki.fi>
3 * SPDX-FileCopyrightText: 2014 John Layt <jlayt@kde.org>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
8#include "frequency_p.h"
9#include "unit_p.h"
10
11#include <KLocalizedString>
12
13namespace KUnitConversion
14{
15
16UnitCategory Frequency::makeCategory()
17{
18 auto c = UnitCategoryPrivate::makeCategory(FrequencyCategory, i18n("Frequency"), i18n("Frequency"));
19 auto d = UnitCategoryPrivate::get(c);
20 KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (frequency", "%1 %2");
21
22 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
23 Yottahertz,
24 1e+24,
25 i18nc("frequency unit symbol", "YHz"),
26 i18nc("unit description in lists", "yottahertzs"),
27 i18nc("unit synonyms for matching user input", "yottahertz;yottahertzs;YHz"),
28 symbolString,
29 ki18nc("amount in units (real)", "%1 yottahertzs"),
30 ki18ncp("amount in units (integer)", "%1 yottahertz", "%1 yottahertzs")));
31
32 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
33 Zettahertz,
34 1e+21,
35 i18nc("frequency unit symbol", "ZHz"),
36 i18nc("unit description in lists", "zettahertzs"),
37 i18nc("unit synonyms for matching user input", "zettahertz;zettahertzs;ZHz"),
38 symbolString,
39 ki18nc("amount in units (real)", "%1 zettahertzs"),
40 ki18ncp("amount in units (integer)", "%1 zettahertz", "%1 zettahertzs")));
41
42 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
43 Exahertz,
44 1e+18,
45 i18nc("frequency unit symbol", "EHz"),
46 i18nc("unit description in lists", "exahertzs"),
47 i18nc("unit synonyms for matching user input", "exahertz;exahertzs;EHz"),
48 symbolString,
49 ki18nc("amount in units (real)", "%1 exahertzs"),
50 ki18ncp("amount in units (integer)", "%1 exahertz", "%1 exahertzs")));
51
52 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
53 Petahertz,
54 1e+15,
55 i18nc("frequency unit symbol", "PHz"),
56 i18nc("unit description in lists", "petahertzs"),
57 i18nc("unit synonyms for matching user input", "petahertz;petahertzs;PHz"),
58 symbolString,
59 ki18nc("amount in units (real)", "%1 petahertzs"),
60 ki18ncp("amount in units (integer)", "%1 petahertz", "%1 petahertzs")));
61
62 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
63 Terahertz,
64 1e+12,
65 i18nc("frequency unit symbol", "THz"),
66 i18nc("unit description in lists", "terahertzs"),
67 i18nc("unit synonyms for matching user input", "terahertz;terahertzs;THz"),
68 symbolString,
69 ki18nc("amount in units (real)", "%1 terahertzs"),
70 ki18ncp("amount in units (integer)", "%1 terahertz", "%1 terahertzs")));
71
72 d->addCommonUnit(UnitPrivate::makeUnit(FrequencyCategory,
73 Gigahertz,
74 1e+09,
75 i18nc("frequency unit symbol", "GHz"),
76 i18nc("unit description in lists", "gigahertzs"),
77 i18nc("unit synonyms for matching user input", "gigahertz;gigahertzs;GHz"),
78 symbolString,
79 ki18nc("amount in units (real)", "%1 gigahertzs"),
80 ki18ncp("amount in units (integer)", "%1 gigahertz", "%1 gigahertzs")));
81
82 d->addCommonUnit(UnitPrivate::makeUnit(FrequencyCategory,
83 Megahertz,
84 1e+06,
85 i18nc("frequency unit symbol", "MHz"),
86 i18nc("unit description in lists", "megahertzs"),
87 i18nc("unit synonyms for matching user input", "megahertz;megahertzs;MHz"),
88 symbolString,
89 ki18nc("amount in units (real)", "%1 megahertzs"),
90 ki18ncp("amount in units (integer)", "%1 megahertz", "%1 megahertzs")));
91
92 d->addCommonUnit(UnitPrivate::makeUnit(FrequencyCategory,
93 Kilohertz,
94 1000,
95 i18nc("frequency unit symbol", "kHz"),
96 i18nc("unit description in lists", "kilohertzs"),
97 i18nc("unit synonyms for matching user input", "kilohertz;kilohertzs;kHz"),
98 symbolString,
99 ki18nc("amount in units (real)", "%1 kilohertzs"),
100 ki18ncp("amount in units (integer)", "%1 kilohertz", "%1 kilohertzs")));
101
102 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
103 Hectohertz,
104 100,
105 i18nc("frequency unit symbol", "hHz"),
106 i18nc("unit description in lists", "hectohertzs"),
107 i18nc("unit synonyms for matching user input", "hectohertz;hectohertzs;hHz"),
108 symbolString,
109 ki18nc("amount in units (real)", "%1 hectohertzs"),
110 ki18ncp("amount in units (integer)", "%1 hectohertz", "%1 hectohertzs")));
111
112 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
113 Decahertz,
114 10,
115 i18nc("frequency unit symbol", "daHz"),
116 i18nc("unit description in lists", "decahertzs"),
117 i18nc("unit synonyms for matching user input", "decahertz;decahertzs;daHz"),
118 symbolString,
119 ki18nc("amount in units (real)", "%1 decahertzs"),
120 ki18ncp("amount in units (integer)", "%1 decahertz", "%1 decahertzs")));
121
122 d->addDefaultUnit(UnitPrivate::makeUnit(FrequencyCategory,
123 Hertz,
124 1,
125 i18nc("frequency unit symbol", "Hz"),
126 i18nc("unit description in lists", "hertzs"),
127 i18nc("unit synonyms for matching user input", "hertz;hertzs;Hz"),
128 symbolString,
129 ki18nc("amount in units (real)", "%1 hertzs"),
130 ki18ncp("amount in units (integer)", "%1 hertz", "%1 hertzs")));
131
132 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
133 Decihertz,
134 0.1,
135 i18nc("frequency unit symbol", "dHz"),
136 i18nc("unit description in lists", "decihertzs"),
137 i18nc("unit synonyms for matching user input", "decihertz;decihertzs;dHz"),
138 symbolString,
139 ki18nc("amount in units (real)", "%1 decihertzs"),
140 ki18ncp("amount in units (integer)", "%1 decihertz", "%1 decihertzs")));
141
142 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
143 Centihertz,
144 0.01,
145 i18nc("frequency unit symbol", "cHz"),
146 i18nc("unit description in lists", "centihertzs"),
147 i18nc("unit synonyms for matching user input", "centihertz;centihertzs;cHz"),
148 symbolString,
149 ki18nc("amount in units (real)", "%1 centihertzs"),
150 ki18ncp("amount in units (integer)", "%1 centihertz", "%1 centihertzs")));
151
152 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
153 Millihertz,
154 0.001,
155 i18nc("frequency unit symbol", "mHz"),
156 i18nc("unit description in lists", "millihertzs"),
157 i18nc("unit synonyms for matching user input", "millihertz;millihertzs;mHz"),
158 symbolString,
159 ki18nc("amount in units (real)", "%1 millihertzs"),
160 ki18ncp("amount in units (integer)", "%1 millihertz", "%1 millihertzs")));
161
162 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
163 Microhertz,
164 1e-06,
165 i18nc("frequency unit symbol", "µHz"),
166 i18nc("unit description in lists", "microhertzs"),
167 i18nc("unit synonyms for matching user input", "microhertz;microhertzs;µHz;uHz"),
168 symbolString,
169 ki18nc("amount in units (real)", "%1 microhertzs"),
170 ki18ncp("amount in units (integer)", "%1 microhertz", "%1 microhertzs")));
171
172 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
173 Nanohertz,
174 1e-09,
175 i18nc("frequency unit symbol", "nHz"),
176 i18nc("unit description in lists", "nanohertzs"),
177 i18nc("unit synonyms for matching user input", "nanohertz;nanohertzs;nHz"),
178 symbolString,
179 ki18nc("amount in units (real)", "%1 nanohertzs"),
180 ki18ncp("amount in units (integer)", "%1 nanohertz", "%1 nanohertzs")));
181
182 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
183 Picohertz,
184 1e-12,
185 i18nc("frequency unit symbol", "pHz"),
186 i18nc("unit description in lists", "picohertzs"),
187 i18nc("unit synonyms for matching user input", "picohertz;picohertzs;pHz"),
188 symbolString,
189 ki18nc("amount in units (real)", "%1 picohertzs"),
190 ki18ncp("amount in units (integer)", "%1 picohertz", "%1 picohertzs")));
191
192 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
193 Femtohertz,
194 1e-15,
195 i18nc("frequency unit symbol", "fHz"),
196 i18nc("unit description in lists", "femtohertzs"),
197 i18nc("unit synonyms for matching user input", "femtohertz;femtohertzs;fHz"),
198 symbolString,
199 ki18nc("amount in units (real)", "%1 femtohertzs"),
200 ki18ncp("amount in units (integer)", "%1 femtohertz", "%1 femtohertzs")));
201
202 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
203 Attohertz,
204 1e-18,
205 i18nc("frequency unit symbol", "aHz"),
206 i18nc("unit description in lists", "attohertzs"),
207 i18nc("unit synonyms for matching user input", "attohertz;attohertzs;aHz"),
208 symbolString,
209 ki18nc("amount in units (real)", "%1 attohertzs"),
210 ki18ncp("amount in units (integer)", "%1 attohertz", "%1 attohertzs")));
211
212 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
213 Zeptohertz,
214 1e-21,
215 i18nc("frequency unit symbol", "zHz"),
216 i18nc("unit description in lists", "zeptohertzs"),
217 i18nc("unit synonyms for matching user input", "zeptohertz;zeptohertzs;zHz"),
218 symbolString,
219 ki18nc("amount in units (real)", "%1 zeptohertzs"),
220 ki18ncp("amount in units (integer)", "%1 zeptohertz", "%1 zeptohertzs")));
221
222 d->addUnit(UnitPrivate::makeUnit(FrequencyCategory,
223 Yoctohertz,
224 1e-24,
225 i18nc("frequency unit symbol", "yHz"),
226 i18nc("unit description in lists", "yoctohertzs"),
227 i18nc("unit synonyms for matching user input", "yoctohertz;yoctohertzs;yHz"),
228 symbolString,
229 ki18nc("amount in units (real)", "%1 yoctohertzs"),
230 ki18ncp("amount in units (integer)", "%1 yoctohertz", "%1 yoctohertzs")));
231
232 d->addCommonUnit(UnitPrivate::makeUnit(FrequencyCategory,
233 RPM,
234 1.0 / 60.0,
235 i18nc("frequency unit symbol", "RPM"),
236 i18nc("unit description in lists", "revolutions per minute"),
237 i18nc("unit synonyms for matching user input", "revolutions per minute;revolution per minute;RPM"),
238 symbolString,
239 ki18nc("amount in units (real)", "%1 revolutions per minute"),
240 ki18ncp("amount in units (integer)", "%1 revolution per minute", "%1 revolutions per minute")));
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 Sat Dec 21 2024 17:06:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.