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(id: FrequencyCategory, i18n("Frequency"), i18n("Frequency"));
19 auto d = UnitCategoryPrivate::get(category: c);
20 KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (frequency", "%1 %2");
21
22 d->addUnit(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
23 id: Yottahertz,
24 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
33 id: Zettahertz,
34 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
43 id: Exahertz,
44 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
53 id: Petahertz,
54 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
63 id: Terahertz,
64 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
73 id: Gigahertz,
74 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
83 id: Megahertz,
84 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
93 id: Kilohertz,
94 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
103 id: Hectohertz,
104 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
113 id: Decahertz,
114 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
123 id: Hertz,
124 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
133 id: Decihertz,
134 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
143 id: Centihertz,
144 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
153 id: Millihertz,
154 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
163 id: Microhertz,
164 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
173 id: Nanohertz,
174 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
183 id: Picohertz,
184 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
193 id: Femtohertz,
194 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
203 id: Attohertz,
204 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
213 id: Zeptohertz,
214 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
223 id: Yoctohertz,
224 multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: FrequencyCategory,
233 id: RPM,
234 multiplier: 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
246

source code of kunitconversion/src/frequency.cpp