| 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 "pressure_p.h" |
| 9 | #include "unit_p.h" |
| 10 | |
| 11 | #include <KLocalizedString> |
| 12 | |
| 13 | namespace KUnitConversion |
| 14 | { |
| 15 | UnitCategory Pressure::makeCategory() |
| 16 | { |
| 17 | auto c = UnitCategoryPrivate::makeCategory(id: PressureCategory, i18n("Pressure" ), i18n("Pressure" )); |
| 18 | auto d = UnitCategoryPrivate::get(category: c); |
| 19 | KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (pressure)" , "%1 %2" ); |
| 20 | |
| 21 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 22 | id: Yottapascal, |
| 23 | multiplier: 1e+24, |
| 24 | i18nc("pressure unit symbol" , "YPa" ), |
| 25 | i18nc("unit description in lists" , "yottapascals" ), |
| 26 | i18nc("unit synonyms for matching user input" , "yottapascal;yottapascals;YPa" ), |
| 27 | symbolString, |
| 28 | ki18nc("amount in units (real)" , "%1 yottapascals" ), |
| 29 | ki18ncp("amount in units (integer)" , "%1 yottapascal" , "%1 yottapascals" ))); |
| 30 | |
| 31 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 32 | id: Zettapascal, |
| 33 | multiplier: 1e+21, |
| 34 | i18nc("pressure unit symbol" , "ZPa" ), |
| 35 | i18nc("unit description in lists" , "zettapascals" ), |
| 36 | i18nc("unit synonyms for matching user input" , "zettapascal;zettapascals;ZPa" ), |
| 37 | symbolString, |
| 38 | ki18nc("amount in units (real)" , "%1 zettapascals" ), |
| 39 | ki18ncp("amount in units (integer)" , "%1 zettapascal" , "%1 zettapascals" ))); |
| 40 | |
| 41 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 42 | id: Exapascal, |
| 43 | multiplier: 1e+18, |
| 44 | i18nc("pressure unit symbol" , "EPa" ), |
| 45 | i18nc("unit description in lists" , "exapascals" ), |
| 46 | i18nc("unit synonyms for matching user input" , "exapascal;exapascals;EPa" ), |
| 47 | symbolString, |
| 48 | ki18nc("amount in units (real)" , "%1 exapascals" ), |
| 49 | ki18ncp("amount in units (integer)" , "%1 exapascal" , "%1 exapascals" ))); |
| 50 | |
| 51 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 52 | id: Petapascal, |
| 53 | multiplier: 1e+15, |
| 54 | i18nc("pressure unit symbol" , "PPa" ), |
| 55 | i18nc("unit description in lists" , "petapascals" ), |
| 56 | i18nc("unit synonyms for matching user input" , "petapascal;petapascals;PPa" ), |
| 57 | symbolString, |
| 58 | ki18nc("amount in units (real)" , "%1 petapascals" ), |
| 59 | ki18ncp("amount in units (integer)" , "%1 petapascal" , "%1 petapascals" ))); |
| 60 | |
| 61 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 62 | id: Terapascal, |
| 63 | multiplier: 1e+12, |
| 64 | i18nc("pressure unit symbol" , "TPa" ), |
| 65 | i18nc("unit description in lists" , "terapascals" ), |
| 66 | i18nc("unit synonyms for matching user input" , "terapascal;terapascals;TPa" ), |
| 67 | symbolString, |
| 68 | ki18nc("amount in units (real)" , "%1 terapascals" ), |
| 69 | ki18ncp("amount in units (integer)" , "%1 terapascal" , "%1 terapascals" ))); |
| 70 | |
| 71 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 72 | id: Gigapascal, |
| 73 | multiplier: 1e+09, |
| 74 | i18nc("pressure unit symbol" , "GPa" ), |
| 75 | i18nc("unit description in lists" , "gigapascals" ), |
| 76 | i18nc("unit synonyms for matching user input" , "gigapascal;gigapascals;GPa" ), |
| 77 | symbolString, |
| 78 | ki18nc("amount in units (real)" , "%1 gigapascals" ), |
| 79 | ki18ncp("amount in units (integer)" , "%1 gigapascal" , "%1 gigapascals" ))); |
| 80 | |
| 81 | d->addCommonUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 82 | id: Megapascal, |
| 83 | multiplier: 1e+06, |
| 84 | i18nc("pressure unit symbol" , "MPa" ), |
| 85 | i18nc("unit description in lists" , "megapascals" ), |
| 86 | i18nc("unit synonyms for matching user input" , "megapascal;megapascals;MPa" ), |
| 87 | symbolString, |
| 88 | ki18nc("amount in units (real)" , "%1 megapascals" ), |
| 89 | ki18ncp("amount in units (integer)" , "%1 megapascal" , "%1 megapascals" ))); |
| 90 | |
| 91 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 92 | id: Kilopascal, |
| 93 | multiplier: 1000, |
| 94 | i18nc("pressure unit symbol" , "kPa" ), |
| 95 | i18nc("unit description in lists" , "kilopascals" ), |
| 96 | i18nc("unit synonyms for matching user input" , "kilopascal;kilopascals;kPa" ), |
| 97 | symbolString, |
| 98 | ki18nc("amount in units (real)" , "%1 kilopascals" ), |
| 99 | ki18ncp("amount in units (integer)" , "%1 kilopascal" , "%1 kilopascals" ))); |
| 100 | |
| 101 | d->addCommonUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 102 | id: Hectopascal, |
| 103 | multiplier: 100, |
| 104 | i18nc("pressure unit symbol" , "hPa" ), |
| 105 | i18nc("unit description in lists" , "hectopascals" ), |
| 106 | i18nc("unit synonyms for matching user input" , "hectopascal;hectopascals;hPa" ), |
| 107 | symbolString, |
| 108 | ki18nc("amount in units (real)" , "%1 hectopascals" ), |
| 109 | ki18ncp("amount in units (integer)" , "%1 hectopascal" , "%1 hectopascals" ))); |
| 110 | |
| 111 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 112 | id: Decapascal, |
| 113 | multiplier: 10, |
| 114 | i18nc("pressure unit symbol" , "daPa" ), |
| 115 | i18nc("unit description in lists" , "decapascals" ), |
| 116 | i18nc("unit synonyms for matching user input" , "decapascal;decapascals;daPa" ), |
| 117 | symbolString, |
| 118 | ki18nc("amount in units (real)" , "%1 decapascals" ), |
| 119 | ki18ncp("amount in units (integer)" , "%1 decapascal" , "%1 decapascals" ))); |
| 120 | |
| 121 | d->addDefaultUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 122 | id: Pascal, |
| 123 | multiplier: 1, |
| 124 | i18nc("pressure unit symbol" , "Pa" ), |
| 125 | i18nc("unit description in lists" , "pascals" ), |
| 126 | i18nc("unit synonyms for matching user input" , "pascal;pascals;Pa" ), |
| 127 | symbolString, |
| 128 | ki18nc("amount in units (real)" , "%1 pascals" ), |
| 129 | ki18ncp("amount in units (integer)" , "%1 pascal" , "%1 pascals" ))); |
| 130 | |
| 131 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 132 | id: Decipascal, |
| 133 | multiplier: 0.1, |
| 134 | i18nc("pressure unit symbol" , "dPa" ), |
| 135 | i18nc("unit description in lists" , "decipascals" ), |
| 136 | i18nc("unit synonyms for matching user input" , "decipascal;decipascals;dPa" ), |
| 137 | symbolString, |
| 138 | ki18nc("amount in units (real)" , "%1 decipascals" ), |
| 139 | ki18ncp("amount in units (integer)" , "%1 decipascal" , "%1 decipascals" ))); |
| 140 | |
| 141 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 142 | id: Centipascal, |
| 143 | multiplier: 0.01, |
| 144 | i18nc("pressure unit symbol" , "cPa" ), |
| 145 | i18nc("unit description in lists" , "centipascals" ), |
| 146 | i18nc("unit synonyms for matching user input" , "centipascal;centipascals;cPa" ), |
| 147 | symbolString, |
| 148 | ki18nc("amount in units (real)" , "%1 centipascals" ), |
| 149 | ki18ncp("amount in units (integer)" , "%1 centipascal" , "%1 centipascals" ))); |
| 150 | |
| 151 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 152 | id: Millipascal, |
| 153 | multiplier: 0.001, |
| 154 | i18nc("pressure unit symbol" , "mPa" ), |
| 155 | i18nc("unit description in lists" , "millipascals" ), |
| 156 | i18nc("unit synonyms for matching user input" , "millipascal;millipascals;mPa" ), |
| 157 | symbolString, |
| 158 | ki18nc("amount in units (real)" , "%1 millipascals" ), |
| 159 | ki18ncp("amount in units (integer)" , "%1 millipascal" , "%1 millipascals" ))); |
| 160 | |
| 161 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 162 | id: Micropascal, |
| 163 | multiplier: 1e-06, |
| 164 | i18nc("pressure unit symbol" , "µPa" ), |
| 165 | i18nc("unit description in lists" , "micropascals" ), |
| 166 | i18nc("unit synonyms for matching user input" , "micropascal;micropascals;µPa;uPa" ), |
| 167 | symbolString, |
| 168 | ki18nc("amount in units (real)" , "%1 micropascals" ), |
| 169 | ki18ncp("amount in units (integer)" , "%1 micropascal" , "%1 micropascals" ))); |
| 170 | |
| 171 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 172 | id: Nanopascal, |
| 173 | multiplier: 1e-09, |
| 174 | i18nc("pressure unit symbol" , "nPa" ), |
| 175 | i18nc("unit description in lists" , "nanopascals" ), |
| 176 | i18nc("unit synonyms for matching user input" , "nanopascal;nanopascals;nPa" ), |
| 177 | symbolString, |
| 178 | ki18nc("amount in units (real)" , "%1 nanopascals" ), |
| 179 | ki18ncp("amount in units (integer)" , "%1 nanopascal" , "%1 nanopascals" ))); |
| 180 | |
| 181 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 182 | id: Picopascal, |
| 183 | multiplier: 1e-12, |
| 184 | i18nc("pressure unit symbol" , "pPa" ), |
| 185 | i18nc("unit description in lists" , "picopascals" ), |
| 186 | i18nc("unit synonyms for matching user input" , "picopascal;picopascals;pPa" ), |
| 187 | symbolString, |
| 188 | ki18nc("amount in units (real)" , "%1 picopascals" ), |
| 189 | ki18ncp("amount in units (integer)" , "%1 picopascal" , "%1 picopascals" ))); |
| 190 | |
| 191 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 192 | id: Femtopascal, |
| 193 | multiplier: 1e-15, |
| 194 | i18nc("pressure unit symbol" , "fPa" ), |
| 195 | i18nc("unit description in lists" , "femtopascals" ), |
| 196 | i18nc("unit synonyms for matching user input" , "femtopascal;femtopascals;fPa" ), |
| 197 | symbolString, |
| 198 | ki18nc("amount in units (real)" , "%1 femtopascals" ), |
| 199 | ki18ncp("amount in units (integer)" , "%1 femtopascal" , "%1 femtopascals" ))); |
| 200 | |
| 201 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 202 | id: Attopascal, |
| 203 | multiplier: 1e-18, |
| 204 | i18nc("pressure unit symbol" , "aPa" ), |
| 205 | i18nc("unit description in lists" , "attopascals" ), |
| 206 | i18nc("unit synonyms for matching user input" , "attopascal;attopascals;aPa" ), |
| 207 | symbolString, |
| 208 | ki18nc("amount in units (real)" , "%1 attopascals" ), |
| 209 | ki18ncp("amount in units (integer)" , "%1 attopascal" , "%1 attopascals" ))); |
| 210 | |
| 211 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 212 | id: Zeptopascal, |
| 213 | multiplier: 1e-21, |
| 214 | i18nc("pressure unit symbol" , "zPa" ), |
| 215 | i18nc("unit description in lists" , "zeptopascals" ), |
| 216 | i18nc("unit synonyms for matching user input" , "zeptopascal;zeptopascals;zPa" ), |
| 217 | symbolString, |
| 218 | ki18nc("amount in units (real)" , "%1 zeptopascals" ), |
| 219 | ki18ncp("amount in units (integer)" , "%1 zeptopascal" , "%1 zeptopascals" ))); |
| 220 | |
| 221 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 222 | id: Yoctopascal, |
| 223 | multiplier: 1e-24, |
| 224 | i18nc("pressure unit symbol" , "yPa" ), |
| 225 | i18nc("unit description in lists" , "yoctopascals" ), |
| 226 | i18nc("unit synonyms for matching user input" , "yoctopascal;yoctopascals;yPa" ), |
| 227 | symbolString, |
| 228 | ki18nc("amount in units (real)" , "%1 yoctopascals" ), |
| 229 | ki18ncp("amount in units (integer)" , "%1 yoctopascal" , "%1 yoctopascals" ))); |
| 230 | |
| 231 | d->addCommonUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 232 | id: Bar, |
| 233 | multiplier: 100000, |
| 234 | i18nc("pressure unit symbol" , "bar" ), |
| 235 | i18nc("unit description in lists" , "bars" ), |
| 236 | i18nc("unit synonyms for matching user input" , "bar;bars;bar" ), |
| 237 | symbolString, |
| 238 | ki18nc("amount in units (real)" , "%1 bars" ), |
| 239 | ki18ncp("amount in units (integer)" , "%1 bar" , "%1 bars" ))); |
| 240 | |
| 241 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 242 | id: Millibar, |
| 243 | multiplier: 100, |
| 244 | i18nc("pressure unit symbol" , "mbar" ), |
| 245 | i18nc("unit description in lists" , "millibars" ), |
| 246 | i18nc("unit synonyms for matching user input" , "millibar;millibars;mbar;mb" ), |
| 247 | symbolString, |
| 248 | ki18nc("amount in units (real)" , "%1 millibars" ), |
| 249 | ki18ncp("amount in units (integer)" , "%1 millibar" , "%1 millibars" ))); |
| 250 | |
| 251 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 252 | id: Decibar, |
| 253 | multiplier: 10000, |
| 254 | i18nc("pressure unit symbol" , "dbar" ), |
| 255 | i18nc("unit description in lists" , "decibars" ), |
| 256 | i18nc("unit synonyms for matching user input" , "decibar;decibars;dbar" ), |
| 257 | symbolString, |
| 258 | ki18nc("amount in units (real)" , "%1 decibars" ), |
| 259 | ki18ncp("amount in units (integer)" , "%1 decibar" , "%1 decibars" ))); |
| 260 | |
| 261 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 262 | id: Torr, |
| 263 | multiplier: 133.322, |
| 264 | i18nc("pressure unit symbol" , "Torr" ), |
| 265 | i18nc("unit description in lists" , "Torr" ), |
| 266 | i18nc("unit synonyms for matching user input" , "Torr" ), |
| 267 | symbolString, |
| 268 | ki18nc("amount in units (real)" , "%1 torr" ), |
| 269 | ki18ncp("amount in units (integer)" , "%1 torr" , "%1 torr" ))); |
| 270 | |
| 271 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 272 | id: TechnicalAtmosphere, |
| 273 | multiplier: 98066.5, |
| 274 | i18nc("pressure unit symbol" , "at" ), |
| 275 | i18nc("unit description in lists" , "technical atmospheres" ), |
| 276 | i18nc("unit synonyms for matching user input" , "technical atmosphere;technical atmospheres;at" ), |
| 277 | symbolString, |
| 278 | ki18nc("amount in units (real)" , "%1 technical atmospheres" ), |
| 279 | ki18ncp("amount in units (integer)" , "%1 technical atmosphere" , "%1 technical atmospheres" ))); |
| 280 | |
| 281 | d->addCommonUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 282 | id: Atmosphere, |
| 283 | multiplier: 101325, |
| 284 | i18nc("pressure unit symbol" , "atm" ), |
| 285 | i18nc("unit description in lists" , "atmospheres" ), |
| 286 | i18nc("unit synonyms for matching user input" , "atmosphere;atmospheres;atm" ), |
| 287 | symbolString, |
| 288 | ki18nc("amount in units (real)" , "%1 atmospheres" ), |
| 289 | ki18ncp("amount in units (integer)" , "%1 atmosphere" , "%1 atmospheres" ))); |
| 290 | |
| 291 | d->addCommonUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 292 | id: PoundForcePerSquareInch, |
| 293 | multiplier: 6894.76, |
| 294 | i18nc("pressure unit symbol" , "psi" ), |
| 295 | i18nc("unit description in lists" , "pound-force per square inch" ), |
| 296 | i18nc("unit synonyms for matching user input" , "pound-force per square inch;pound-force per square inches;psi" ), |
| 297 | symbolString, |
| 298 | ki18nc("amount in units (real)" , "%1 pound-force per square inches" ), |
| 299 | ki18ncp("amount in units (integer)" , "%1 pound-force per square inch" , "%1 pound-force per square inch" ))); |
| 300 | |
| 301 | // http://en.wikipedia.org/wiki/InHg |
| 302 | d->addCommonUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 303 | id: InchesOfMercury, |
| 304 | multiplier: 3386.39, |
| 305 | i18nc("pressure unit symbol" , "inHg" ), |
| 306 | i18nc("unit description in lists" , "inches of mercury" ), |
| 307 | i18nc("unit synonyms for matching user input" , "inch of mercury;inches of mercury;inHg;in\"" ), |
| 308 | symbolString, |
| 309 | ki18nc("amount in units (real)" , "%1 inches of mercury" ), |
| 310 | ki18ncp("amount in units (integer)" , "%1 inches of mercury" , "%1 inches of mercury" ))); |
| 311 | |
| 312 | // http://en.wikipedia.org/wiki/MmHg#mmHg |
| 313 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: PressureCategory, |
| 314 | id: MillimetersOfMercury, |
| 315 | multiplier: 133.322, |
| 316 | i18nc("pressure unit symbol" , "mmHg" ), |
| 317 | i18nc("unit description in lists" , "millimeters of mercury" ), |
| 318 | i18nc("unit synonyms for matching user input" , "millimeter of mercury;millimeters of mercury;mmHg" ), |
| 319 | symbolString, |
| 320 | ki18nc("amount in units (real)" , "%1 millimeters of mercury" ), |
| 321 | ki18ncp("amount in units (integer)" , "%1 millimeters of mercury" , "%1 millimeters of mercury" ))); |
| 322 | |
| 323 | return c; |
| 324 | } |
| 325 | |
| 326 | } // KUnitConversion namespace |
| 327 | |