File indexing completed on 2024-04-21 03:58:32

0001 /*
0002  *   SPDX-FileCopyrightText: 2010 Petri Damstén <damu@iki.fi>
0003  *   SPDX-FileCopyrightText: 2014 John Layt <jlayt@kde.org>
0004  *   SPDX-FileCopyrightText: 2014 Garret Wassermann <gwasser@gmail.com>
0005  *
0006  *   SPDX-License-Identifier: LGPL-2.0-or-later
0007  */
0008 
0009 #include "unit_p.h"
0010 #include "voltage_p.h"
0011 
0012 #include <KLocalizedString>
0013 
0014 namespace KUnitConversion
0015 {
0016 UnitCategory Voltage::makeCategory()
0017 {
0018     auto c = UnitCategoryPrivate::makeCategory(VoltageCategory, i18n("Voltage"), i18n("Voltage"));
0019     auto d = UnitCategoryPrivate::get(c);
0020     KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (voltage", "%1 %2");
0021 
0022     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0023                        Yottavolts,
0024                        1e+24,
0025                        i18nc("voltage unit symbol", "YV"),
0026                        i18nc("unit description in lists", "yottavolts"),
0027                        i18nc("unit synonyms for matching user input", "yottavolt;yottavolts;YV"),
0028                        symbolString,
0029                        ki18nc("amount in units (real)", "%1 yottavolts"),
0030                        ki18ncp("amount in units (integer)", "%1 yottavolt", "%1 yottavolts")));
0031 
0032     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0033                        Zettavolts,
0034                        1e+21,
0035                        i18nc("voltage unit symbol", "ZV"),
0036                        i18nc("unit description in lists", "zettavolts"),
0037                        i18nc("unit synonyms for matching user input", "zettavolt;zettavolts;ZV"),
0038                        symbolString,
0039                        ki18nc("amount in units (real)", "%1 zettavolts"),
0040                        ki18ncp("amount in units (integer)", "%1 zettavolt", "%1 zettavolts")));
0041 
0042     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0043                        Exavolts,
0044                        1e+18,
0045                        i18nc("voltage unit symbol", "EV"),
0046                        i18nc("unit description in lists", "exavolts"),
0047                        i18nc("unit synonyms for matching user input", "exavolt;exavolts;EV"),
0048                        symbolString,
0049                        ki18nc("amount in units (real)", "%1 exavolts"),
0050                        ki18ncp("amount in units (integer)", "%1 exavolt", "%1 exavolts")));
0051 
0052     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0053                        Petavolts,
0054                        1e+15,
0055                        i18nc("voltage unit symbol", "PV"),
0056                        i18nc("unit description in lists", "petavolts"),
0057                        i18nc("unit synonyms for matching user input", "petavolt;petavolts;PV"),
0058                        symbolString,
0059                        ki18nc("amount in units (real)", "%1 petavolts"),
0060                        ki18ncp("amount in units (integer)", "%1 petavolt", "%1 petavolts")));
0061 
0062     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0063                        Teravolts,
0064                        1e+12,
0065                        i18nc("voltage unit symbol", "TV"),
0066                        i18nc("unit description in lists", "teravolts"),
0067                        i18nc("unit synonyms for matching user input", "teravolt;teravolts;TV"),
0068                        symbolString,
0069                        ki18nc("amount in units (real)", "%1 teravolts"),
0070                        ki18ncp("amount in units (integer)", "%1 teravolt", "%1 teravolts")));
0071 
0072     d->addCommonUnit(UnitPrivate::makeUnit(VoltageCategory,
0073                              Gigavolts,
0074                              1e+09,
0075                              i18nc("voltage unit symbol", "GV"),
0076                              i18nc("unit description in lists", "gigavolts"),
0077                              i18nc("unit synonyms for matching user input", "gigavolt;gigavolts;GV"),
0078                              symbolString,
0079                              ki18nc("amount in units (real)", "%1 gigavolts"),
0080                              ki18ncp("amount in units (integer)", "%1 gigavolt", "%1 gigavolts")));
0081 
0082     d->addCommonUnit(UnitPrivate::makeUnit(VoltageCategory,
0083                              Megavolts,
0084                              1e+06,
0085                              i18nc("voltage unit symbol", "MV"),
0086                              i18nc("unit description in lists", "megavolts"),
0087                              i18nc("unit synonyms for matching user input", "megavolt;megavolts;MV"),
0088                              symbolString,
0089                              ki18nc("amount in units (real)", "%1 megavolts"),
0090                              ki18ncp("amount in units (integer)", "%1 megavolt", "%1 megavolts")));
0091 
0092     d->addCommonUnit(UnitPrivate::makeUnit(VoltageCategory,
0093                              Kilovolts,
0094                              1000,
0095                              i18nc("voltage unit symbol", "kV"),
0096                              i18nc("unit description in lists", "kilovolts"),
0097                              i18nc("unit synonyms for matching user input", "kilovolt;kilovolts;kV"),
0098                              symbolString,
0099                              ki18nc("amount in units (real)", "%1 kilovolts"),
0100                              ki18ncp("amount in units (integer)", "%1 kilovolt", "%1 kilovolts")));
0101 
0102     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0103                        Hectovolts,
0104                        100,
0105                        i18nc("voltage unit symbol", "hV"),
0106                        i18nc("unit description in lists", "hectovolts"),
0107                        i18nc("unit synonyms for matching user input", "hectovolt;hectovolts;hV"),
0108                        symbolString,
0109                        ki18nc("amount in units (real)", "%1 hectovolts"),
0110                        ki18ncp("amount in units (integer)", "%1 hectovolt", "%1 hectovolts")));
0111 
0112     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0113                        Decavolts,
0114                        10,
0115                        i18nc("voltage unit symbol", "daV"),
0116                        i18nc("unit description in lists", "decavolts"),
0117                        i18nc("unit synonyms for matching user input", "decavolt;decavolts;daV"),
0118                        symbolString,
0119                        ki18nc("amount in units (real)", "%1 decavolts"),
0120                        ki18ncp("amount in units (integer)", "%1 decavolt", "%1 decavolts")));
0121 
0122     d->addDefaultUnit(UnitPrivate::makeUnit(VoltageCategory,
0123                               Volts,
0124                               1,
0125                               i18nc("voltage unit symbol", "V"),
0126                               i18nc("unit description in lists", "volts"),
0127                               i18nc("unit synonyms for matching user input", "volt;volts;V"),
0128                               symbolString,
0129                               ki18nc("amount in units (real)", "%1 volts"),
0130                               ki18ncp("amount in units (integer)", "%1 volt", "%1 volts")));
0131 
0132     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0133                        Decivolts,
0134                        0.1,
0135                        i18nc("voltage unit symbol", "dV"),
0136                        i18nc("unit description in lists", "decivolts"),
0137                        i18nc("unit synonyms for matching user input", "decivolt;decivolts;dV"),
0138                        symbolString,
0139                        ki18nc("amount in units (real)", "%1 decivolts"),
0140                        ki18ncp("amount in units (integer)", "%1 decivolt", "%1 decivolts")));
0141 
0142     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0143                        Centivolts,
0144                        0.01,
0145                        i18nc("voltage unit symbol", "cV"),
0146                        i18nc("unit description in lists", "centivolts"),
0147                        i18nc("unit synonyms for matching user input", "centivolt;centivolts;cV"),
0148                        symbolString,
0149                        ki18nc("amount in units (real)", "%1 centivolts"),
0150                        ki18ncp("amount in units (integer)", "%1 centivolt", "%1 centivolts")));
0151 
0152     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0153                        Millivolts,
0154                        0.001,
0155                        i18nc("voltage unit symbol", "mV"),
0156                        i18nc("unit description in lists", "millivolts"),
0157                        i18nc("unit synonyms for matching user input", "millivolt;millivolts;mV"),
0158                        symbolString,
0159                        ki18nc("amount in units (real)", "%1 millivolts"),
0160                        ki18ncp("amount in units (integer)", "%1 millivolt", "%1 millivolts")));
0161 
0162     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0163                        Microvolts,
0164                        1e-06,
0165                        i18nc("voltage unit symbol", "µV"),
0166                        i18nc("unit description in lists", "microvolts"),
0167                        i18nc("unit synonyms for matching user input", "microvolt;microvolts;µV;uV"),
0168                        symbolString,
0169                        ki18nc("amount in units (real)", "%1 microvolts"),
0170                        ki18ncp("amount in units (integer)", "%1 microvolt", "%1 microvolts")));
0171 
0172     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0173                        Nanovolts,
0174                        1e-09,
0175                        i18nc("voltage unit symbol", "nV"),
0176                        i18nc("unit description in lists", "nanovolts"),
0177                        i18nc("unit synonyms for matching user input", "nanovolt;nanovolts;nV"),
0178                        symbolString,
0179                        ki18nc("amount in units (real)", "%1 nanovolts"),
0180                        ki18ncp("amount in units (integer)", "%1 nanovolt", "%1 nanovolts")));
0181 
0182     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0183                        Picovolts,
0184                        1e-12,
0185                        i18nc("voltage unit symbol", "pV"),
0186                        i18nc("unit description in lists", "picovolts"),
0187                        i18nc("unit synonyms for matching user input", "picovolt;picovolts;pV"),
0188                        symbolString,
0189                        ki18nc("amount in units (real)", "%1 picovolts"),
0190                        ki18ncp("amount in units (integer)", "%1 picovolt", "%1 picovolts")));
0191 
0192     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0193                        Femtovolts,
0194                        1e-15,
0195                        i18nc("voltage unit symbol", "fV"),
0196                        i18nc("unit description in lists", "femtovolts"),
0197                        i18nc("unit synonyms for matching user input", "femtovolt;femtovolts;fV"),
0198                        symbolString,
0199                        ki18nc("amount in units (real)", "%1 femtovolts"),
0200                        ki18ncp("amount in units (integer)", "%1 femtovolt", "%1 femtovolts")));
0201 
0202     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0203                        Attovolts,
0204                        1e-18,
0205                        i18nc("voltage unit symbol", "aV"),
0206                        i18nc("unit description in lists", "attovolts"),
0207                        i18nc("unit synonyms for matching user input", "attovolt;attovolts;aV"),
0208                        symbolString,
0209                        ki18nc("amount in units (real)", "%1 attovolts"),
0210                        ki18ncp("amount in units (integer)", "%1 attovolt", "%1 attovolts")));
0211 
0212     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0213                        Zeptovolts,
0214                        1e-21,
0215                        i18nc("voltage unit symbol", "zV"),
0216                        i18nc("unit description in lists", "zeptovolts"),
0217                        i18nc("unit synonyms for matching user input", "zeptovolt;zeptovolts;zV"),
0218                        symbolString,
0219                        ki18nc("amount in units (real)", "%1 zeptovolts"),
0220                        ki18ncp("amount in units (integer)", "%1 zeptovolt", "%1 zeptovolts")));
0221 
0222     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0223                        Yoctovolts,
0224                        1e-24,
0225                        i18nc("voltage unit symbol", "yV"),
0226                        i18nc("unit description in lists", "yoctovolts"),
0227                        i18nc("unit synonyms for matching user input", "yoctovolt;yoctovolts;yV"),
0228                        symbolString,
0229                        ki18nc("amount in units (real)", "%1 yoctovolts"),
0230                        ki18ncp("amount in units (integer)", "%1 yoctovolt", "%1 yoctovolts")));
0231 
0232     d->addUnit(UnitPrivate::makeUnit(VoltageCategory,
0233                        Statvolts,
0234                        299.792458,
0235                        i18nc("voltage unit symbol", "stV"),
0236                        i18nc("unit description in lists", "statvolts"),
0237                        i18nc("unit synonyms for matching user input", "statvolt;statvolts;stV"),
0238                        symbolString,
0239                        ki18nc("amount in units (real)", "%1 statvolts"),
0240                        ki18ncp("amount in units (integer)", "%1 statvolt", "%1 statvolts")));
0241 
0242     return c;
0243 }
0244 
0245 } // KUnitConversion namespace