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 | |
13 | namespace KUnitConversion |
14 | { |
15 | UnitCategory Density::makeCategory() |
16 | { |
17 | auto c = UnitCategoryPrivate::makeCategory(id: DensityCategory, i18n("Density" ), i18n("Density" )); |
18 | auto d = UnitCategoryPrivate::get(category: c); |
19 | KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (density)" , "%1 %2" ); |
20 | |
21 | d->addDefaultUnit(unit: UnitPrivate::makeUnit(categoryId: DensityCategory, |
22 | id: KilogramsPerCubicMeter, |
23 | multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: DensityCategory, |
33 | id: KilogramPerLiter, |
34 | multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: DensityCategory, |
43 | id: GramPerLiter, |
44 | multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: DensityCategory, |
53 | id: GramPerMilliliter, |
54 | multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: DensityCategory, |
64 | id: OuncePerCubicInch, |
65 | multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: DensityCategory, |
74 | id: OuncePerCubicFoot, |
75 | multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: DensityCategory, |
84 | id: PoundPerCubicInch, |
85 | multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: DensityCategory, |
94 | id: PoundPerCubicFoot, |
95 | multiplier: 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(unit: UnitPrivate::makeUnit(categoryId: DensityCategory, |
104 | id: PoundPerCubicYard, |
105 | multiplier: 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 |
117 | |