KUnitConversion

density.cpp
1/*
2 * SPDX-FileCopyrightText: 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 "density_p.h"
9#include "unit_p.h"
10
11#include <KLocalizedString>
12
13namespace KUnitConversion
14{
15UnitCategory Density::makeCategory()
16{
17 auto c = UnitCategoryPrivate::makeCategory(DensityCategory, i18n("Density"), i18n("Density"));
18 auto d = UnitCategoryPrivate::get(c);
19 KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (density)", "%1 %2");
20
21 d->addDefaultUnit(UnitPrivate::makeUnit(DensityCategory,
22 KilogramsPerCubicMeter,
23 1,
24 i18nc("density unit symbol", "kg/m³"),
25 i18nc("unit description in lists", "kilograms per cubic meter"),
26 i18nc("unit synonyms for matching user input", "kilogram per cubic meter;kilograms per cubic meter;kg/m³"),
27 symbolString,
28 ki18nc("amount in units (real)", "%1 kilograms per cubic meter"),
29 ki18ncp("amount in units (integer)", "%1 kilogram per cubic meter", "%1 kilograms per cubic meter")));
30
31 // source Google calculator
32 d->addCommonUnit(UnitPrivate::makeUnit(DensityCategory,
33 KilogramPerLiter,
34 1000,
35 i18nc("density unit symbol", "kg/l"),
36 i18nc("unit description in lists", "kilograms per liter"),
37 i18nc("unit synonyms for matching user input", "kilogram per liter;kilograms per liter;kg/l"),
38 symbolString,
39 ki18nc("amount in units (real)", "%1 kilograms per liter"),
40 ki18ncp("amount in units (integer)", "%1 kilogram per liter", "%1 kilograms per liter")));
41
42 d->addUnit(UnitPrivate::makeUnit(DensityCategory,
43 GramPerLiter,
44 1,
45 i18nc("density unit symbol", "g/l"),
46 i18nc("unit description in lists", "grams per liter"),
47 i18nc("unit synonyms for matching user input", "gram per liter;grams per liter;g/l"),
48 symbolString,
49 ki18nc("amount in units (real)", "%1 grams per liter"),
50 ki18ncp("amount in units (integer)", "%1 gram per liter", "%1 grams per liter")));
51
52 d->addUnit(UnitPrivate::makeUnit(DensityCategory,
53 GramPerMilliliter,
54 1000,
55 i18nc("density unit symbol", "g/ml"),
56 i18nc("unit description in lists", "grams per milliliter"),
57 i18nc("unit synonyms for matching user input", "gram per milliliter;grams per milliliter;g/ml"),
58 symbolString,
59 ki18nc("amount in units (real)", "%1 grams per milliliter"),
60 ki18ncp("amount in units (integer)", "%1 gram per milliliter", "%1 grams per milliliter")));
61
62 // source : Google calculator
63 d->addUnit(UnitPrivate::makeUnit(DensityCategory,
64 OuncePerCubicInch,
65 1729.99404,
66 i18nc("density unit symbol", "oz/in³"),
67 i18nc("unit description in lists", "ounces per cubic inch"),
68 i18nc("unit synonyms for matching user input", "ounce per cubic inch;ounces per cubic inch;oz/in³"),
69 symbolString,
70 ki18nc("amount in units (real)", "%1 ounces per cubic inch"),
71 ki18ncp("amount in units (integer)", "%1 ounce per cubic inch", "%1 ounces per cubic inch")));
72
73 d->addCommonUnit(UnitPrivate::makeUnit(DensityCategory,
74 OuncePerCubicFoot,
75 1.00115396,
76 i18nc("density unit symbol", "oz/ft³"),
77 i18nc("unit description in lists", "ounces per cubic foot"),
78 i18nc("unit synonyms for matching user input", "ounce per cubic foot;ounces per cubic foot;oz/ft³"),
79 symbolString,
80 ki18nc("amount in units (real)", "%1 ounces per cubic foot"),
81 ki18ncp("amount in units (integer)", "%1 ounce per cubic foot", "%1 ounces per cubic foot")));
82
83 d->addUnit(UnitPrivate::makeUnit(DensityCategory,
84 PoundPerCubicInch,
85 27679.9047,
86 i18nc("density unit symbol", "lb/in³"),
87 i18nc("unit description in lists", "pounds per cubic inch"),
88 i18nc("unit synonyms for matching user input", "pound per cubic inch;pounds per cubic inch;lb/in³"),
89 symbolString,
90 ki18nc("amount in units (real)", "%1 pounds per cubic inch"),
91 ki18ncp("amount in units (integer)", "%1 pound per cubic inch", "%1 pounds per cubic inch")));
92
93 d->addUnit(UnitPrivate::makeUnit(DensityCategory,
94 PoundPerCubicFoot,
95 16.0184634,
96 i18nc("density unit symbol", "lb/ft³"),
97 i18nc("unit description in lists", "pounds per cubic foot"),
98 i18nc("unit synonyms for matching user input", "pound per cubic foot;pounds per cubic foot;lb/ft³"),
99 symbolString,
100 ki18nc("amount in units (real)", "%1 pounds per cubic foot"),
101 ki18ncp("amount in units (integer)", "%1 pound per cubic foot", "%1 pounds per cubic foot")));
102
103 d->addUnit(UnitPrivate::makeUnit(DensityCategory,
104 PoundPerCubicYard,
105 0.593276421,
106 i18nc("density unit symbol", "lb/yd³"),
107 i18nc("unit description in lists", "pounds per cubic yard"),
108 i18nc("unit synonyms for matching user input", "pound per cubic yard;pounds per cubic yard;lb/yd³"),
109 symbolString,
110 ki18nc("amount in units (real)", "%1 pounds per cubic yard"),
111 ki18ncp("amount in units (integer)", "%1 pound per cubic yard", "%1 pounds per cubic yard")));
112
113 return c;
114}
115
116} // 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 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.