KUnitConversion

area.cpp
1/*
2 * SPDX-FileCopyrightText: 2007-2009 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 "area_p.h"
9#include "unit_p.h"
10
11#include <KLocalizedString>
12
13namespace KUnitConversion
14{
15
16UnitCategory Area::makeCategory()
17{
18 auto c = UnitCategoryPrivate::makeCategory(AreaCategory,
19 i18nc("Unit Category: two dimensional size of a surface", "Area"),
20 i18nc("Unit Category: two dimensional size of a surface", "Area"));
21 auto d = UnitCategoryPrivate::get(c);
22 // i18n: Used when converting to symbol string e.g. 2.34 m²
23 KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (area)", "%1 %2");
24
25 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
26 SquareYottameter,
27 1e+48,
28 // i18n: Used when unit symbol is needed.
29 i18nc("area unit symbol", "Ym²"),
30 // i18n: unit as it will be shown to user wherever units are to
31 // be explicitly selected (listbox, radio buttons, checkboxes...).
32 // E.g. an application may give option "Unit of wind speed: [unit-list-box]"
33 i18nc("unit description in lists", "square yottameters"),
34 // i18n: Messages such as this one provide synonyms for each unit,
35 // in order to guess the unit from the text that the user inputs.
36 // Synonyms are semicolon-separated, and you can add as many as
37 // you need (either equal to, more, or less than in the original).
38 // Note that any gramatical inflections of unit names
39 // (such as plural and cases) should also be listed.
40 i18nc("unit synonyms for matching user input", "square yottameter;square yottameters;Ym²;Ym/-2;Ym^2;Ym2"),
41 symbolString,
42 // i18n: This is used when a real-valued amount in units is given,
43 // such as "0.37 miles".
44 ki18nc("amount in units (real)", "%1 square yottameters"),
45 // i18n: This is used when a integer-valued amount in units is given,
46 // such as "1 mile" or "21 miles".
47 ki18ncp("amount in units (integer)", "%1 square yottameter", "%1 square yottameters")));
48
49 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
50 SquareZettameter,
51 1e+42,
52 i18nc("area unit symbol", "Zm²"),
53 i18nc("unit description in lists", "square zettameters"),
54 i18nc("unit synonyms for matching user input", "square zettameter;square zettameters;Zm²;Zm/-2;Zm^2;Zm2"),
55 symbolString,
56 ki18nc("amount in units (real)", "%1 square zettameters"),
57 ki18ncp("amount in units (integer)", "%1 square zettameter", "%1 square zettameters")));
58
59 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
60 SquareExameter,
61 1e+36,
62 i18nc("area unit symbol", "Em²"),
63 i18nc("unit description in lists", "square exameters"),
64 i18nc("unit synonyms for matching user input", "square exameter;square exameters;Em²;Em/-2;Em^2;Em2"),
65 symbolString,
66 ki18nc("amount in units (real)", "%1 square exameters"),
67 ki18ncp("amount in units (integer)", "%1 square exameter", "%1 square exameters")));
68
69 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
70 SquarePetameter,
71 1e+30,
72 i18nc("area unit symbol", "Pm²"),
73 i18nc("unit description in lists", "square petameters"),
74 i18nc("unit synonyms for matching user input", "square petameter;square petameters;Pm²;Pm/-2;Pm^2;Pm2"),
75 symbolString,
76 ki18nc("amount in units (real)", "%1 square petameters"),
77 ki18ncp("amount in units (integer)", "%1 square petameter", "%1 square petameters")));
78
79 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
80 SquareTerameter,
81 1e+24,
82 i18nc("area unit symbol", "Tm²"),
83 i18nc("unit description in lists", "square terameters"),
84 i18nc("unit synonyms for matching user input", "square terameter;square terameters;Tm²;Tm/-2;Tm^2;Tm2"),
85 symbolString,
86 ki18nc("amount in units (real)", "%1 square terameters"),
87 ki18ncp("amount in units (integer)", "%1 square terameter", "%1 square terameters")));
88
89 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
90 SquareGigameter,
91 1e+18,
92 i18nc("area unit symbol", "Gm²"),
93 i18nc("unit description in lists", "square gigameters"),
94 i18nc("unit synonyms for matching user input", "square gigameter;square gigameters;Gm²;Gm/-2;Gm^2;Gm2"),
95 symbolString,
96 ki18nc("amount in units (real)", "%1 square gigameters"),
97 ki18ncp("amount in units (integer)", "%1 square gigameter", "%1 square gigameters")));
98
99 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
100 SquareMegameter,
101 1e+12,
102 i18nc("area unit symbol", "Mm²"),
103 i18nc("unit description in lists", "square megameters"),
104 i18nc("unit synonyms for matching user input", "square megameter;square megameters;Mm²;Mm/-2;Mm^2;Mm2"),
105 symbolString,
106 ki18nc("amount in units (real)", "%1 square megameters"),
107 ki18ncp("amount in units (integer)", "%1 square megameter", "%1 square megameters")));
108
109 d->addCommonUnit(UnitPrivate::makeUnit(AreaCategory,
110 SquareKilometer,
111 1e+06,
112 i18nc("area unit symbol", "km²"),
113 i18nc("unit description in lists", "square kilometers"),
114 i18nc("unit synonyms for matching user input", "square kilometer;square kilometers;sq km;km²;km/-2;km^2;km2"),
115 symbolString,
116 ki18nc("amount in units (real)", "%1 square kilometers"),
117 ki18ncp("amount in units (integer)", "%1 square kilometer", "%1 square kilometers")));
118
119 d->addCommonUnit(UnitPrivate::makeUnit(AreaCategory,
120 SquareHectometer,
121 10000,
122 i18nc("area unit symbol", "hm²"),
123 i18nc("unit description in lists", "square hectometers"),
124 i18nc("unit synonyms for matching user input", "square hectometer;square hectometers;hm²;hm/-2;hm^2;hm2;hectare;hectares"),
125 symbolString,
126 ki18nc("amount in units (real)", "%1 square hectometers"),
127 ki18ncp("amount in units (integer)", "%1 square hectometer", "%1 square hectometers")));
128
129 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
130 SquareDecameter,
131 100,
132 i18nc("area unit symbol", "dam²"),
133 i18nc("unit description in lists", "square decameters"),
134 i18nc("unit synonyms for matching user input", "square decameter;square decameters;dam²;dam/-2;dam^2;dam2"),
135 symbolString,
136 ki18nc("amount in units (real)", "%1 square decameters"),
137 ki18ncp("amount in units (integer)", "%1 square decameter", "%1 square decameters")));
138
139 d->addDefaultUnit(UnitPrivate::makeUnit(AreaCategory,
140 SquareMeter,
141 1,
142 i18nc("area unit symbol", "m²"),
143 i18nc("unit description in lists", "square meters"),
144 i18nc("unit synonyms for matching user input", "square meter;square meters;sq m;m²;m/-2;m^2;m2"),
145 symbolString,
146 ki18nc("amount in units (real)", "%1 square meters"),
147 ki18ncp("amount in units (integer)", "%1 square meter", "%1 square meters")));
148
149 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
150 SquareDecimeter,
151 0.01,
152 i18nc("area unit symbol", "dm²"),
153 i18nc("unit description in lists", "square decimeters"),
154 i18nc("unit synonyms for matching user input", "square decimeter;square decimeters;dm²;dm/-2;dm^2;dm2"),
155 symbolString,
156 ki18nc("amount in units (real)", "%1 square decimeters"),
157 ki18ncp("amount in units (integer)", "%1 square decimeter", "%1 square decimeters")));
158
159 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
160 SquareCentimeter,
161 0.0001,
162 i18nc("area unit symbol", "cm²"),
163 i18nc("unit description in lists", "square centimeters"),
164 i18nc("unit synonyms for matching user input", "square centimeter;square centimeters;sq cm;cm²;cm/-2;cm^2;cm2"),
165 symbolString,
166 ki18nc("amount in units (real)", "%1 square centimeters"),
167 ki18ncp("amount in units (integer)", "%1 square centimeter", "%1 square centimeters")));
168
169 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
170 SquareMillimeter,
171 1e-06,
172 i18nc("area unit symbol", "mm²"),
173 i18nc("unit description in lists", "square millimeters"),
174 i18nc("unit synonyms for matching user input", "square millimeter;square millimeters;sq mm;mm²;mm/-2;mm^2;mm2"),
175 symbolString,
176 ki18nc("amount in units (real)", "%1 square millimeters"),
177 ki18ncp("amount in units (integer)", "%1 square millimeter", "%1 square millimeters")));
178
179 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
180 SquareMicrometer,
181 1e-12,
182 i18nc("area unit symbol", "µm²"),
183 i18nc("unit description in lists", "square micrometers"),
184 i18nc("unit synonyms for matching user input", "square micrometer;square micrometers;µm²;um²;µm/-2;µm^2;µm2"),
185 symbolString,
186 ki18nc("amount in units (real)", "%1 square micrometers"),
187 ki18ncp("amount in units (integer)", "%1 square micrometer", "%1 square micrometers")));
188
189 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
190 SquareNanometer,
191 1e-18,
192 i18nc("area unit symbol", "nm²"),
193 i18nc("unit description in lists", "square nanometers"),
194 i18nc("unit synonyms for matching user input", "square nanometer;square nanometers;nm²;nm/-2;nm^2;nm2"),
195 symbolString,
196 ki18nc("amount in units (real)", "%1 square nanometers"),
197 ki18ncp("amount in units (integer)", "%1 square nanometer", "%1 square nanometers")));
198
199 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
200 SquarePicometer,
201 1e-24,
202 i18nc("area unit symbol", "pm²"),
203 i18nc("unit description in lists", "square picometers"),
204 i18nc("unit synonyms for matching user input", "square picometer;square picometers;pm²;pm/-2;pm^2;pm2"),
205 symbolString,
206 ki18nc("amount in units (real)", "%1 square picometers"),
207 ki18ncp("amount in units (integer)", "%1 square picometer", "%1 square picometers")));
208
209 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
210 SquareFemtometer,
211 1e-30,
212 i18nc("area unit symbol", "fm²"),
213 i18nc("unit description in lists", "square femtometers"),
214 i18nc("unit synonyms for matching user input", "square femtometer;square femtometers;fm²;fm/-2;fm^2;fm2"),
215 symbolString,
216 ki18nc("amount in units (real)", "%1 square femtometers"),
217 ki18ncp("amount in units (integer)", "%1 square femtometer", "%1 square femtometers")));
218
219 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
220 SquareAttometer,
221 1e-36,
222 i18nc("area unit symbol", "am²"),
223 i18nc("unit description in lists", "square attometers"),
224 i18nc("unit synonyms for matching user input", "square attometer;square attometers;am²;am/-2;am^2;am2"),
225 symbolString,
226 ki18nc("amount in units (real)", "%1 square attometers"),
227 ki18ncp("amount in units (integer)", "%1 square attometer", "%1 square attometers")));
228
229 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
230 SquareZeptometer,
231 1e-42,
232 i18nc("area unit symbol", "zm²"),
233 i18nc("unit description in lists", "square zeptometers"),
234 i18nc("unit synonyms for matching user input", "square zeptometer;square zeptometers;zm²;zm/-2;zm^2;zm2"),
235 symbolString,
236 ki18nc("amount in units (real)", "%1 square zeptometers"),
237 ki18ncp("amount in units (integer)", "%1 square zeptometer", "%1 square zeptometers")));
238
239 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
240 SquareYoctometer,
241 1e-48,
242 i18nc("area unit symbol", "ym²"),
243 i18nc("unit description in lists", "square yoctometers"),
244 i18nc("unit synonyms for matching user input", "square yoctometer;square yoctometers;ym²;ym/-2;ym^2;ym2"),
245 symbolString,
246 ki18nc("amount in units (real)", "%1 square yoctometers"),
247 ki18ncp("amount in units (integer)", "%1 square yoctometer", "%1 square yoctometers")));
248
249 d->addCommonUnit(UnitPrivate::makeUnit(AreaCategory,
250 Acre,
251 4046.86,
252 i18nc("area unit symbol", "acre"),
253 i18nc("unit description in lists", "acres"),
254 i18nc("unit synonyms for matching user input", "acre;acres"),
255 symbolString,
256 ki18nc("amount in units (real)", "%1 acres"),
257 ki18ncp("amount in units (integer)", "%1 acre", "%1 acres")));
258
259 d->addCommonUnit(UnitPrivate::makeUnit(AreaCategory,
260 SquareFoot,
261 0.092903,
262 i18nc("area unit symbol", "ft²"),
263 i18nc("unit description in lists", "square feet"),
264 i18nc("unit synonyms for matching user input", "square foot;square feet;ft²;square ft;sq foot;sq ft;sq feet;feet²"),
265 symbolString,
266 ki18nc("amount in units (real)", "%1 square feet"),
267 ki18ncp("amount in units (integer)", "%1 square foot", "%1 square feet")));
268
269 d->addUnit(UnitPrivate::makeUnit(AreaCategory,
270 SquareInch,
271 0.00064516,
272 i18nc("area unit symbol", "in²"),
273 i18nc("unit description in lists", "square inches"),
274 i18nc("unit synonyms for matching user input", "square inch;square inches;in²;square inch;square in;sq inches;sq inch;sq in;inch²"),
275 symbolString,
276 ki18nc("amount in units (real)", "%1 square inches"),
277 ki18ncp("amount in units (integer)", "%1 square inch", "%1 square inches")));
278
279 d->addCommonUnit(UnitPrivate::makeUnit(AreaCategory,
280 SquareMile,
281 2.58999e+06,
282 i18nc("area unit symbol", "mi²"),
283 i18nc("unit description in lists", "square miles"),
284 i18nc("unit synonyms for matching user input", "square mile;square miles;mi²;square mi;sq miles;sq mile;sq mi;mile²"),
285 symbolString,
286 ki18nc("amount in units (real)", "%1 square miles"),
287 ki18ncp("amount in units (integer)", "%1 square mile", "%1 square miles")));
288
289 return c;
290}
291
292} // 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)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:10:06 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.