| 1 | /* |
| 2 | * SPDX-FileCopyrightText: 2010 Petri Damstén <damu@iki.fi> |
| 3 | * SPDX-FileCopyrightText: 2014 John Layt <jlayt@kde.org> |
| 4 | * SPDX-FileCopyrightText: 2014 Garret Wassermann <gwasser@gmail.com> |
| 5 | * |
| 6 | * SPDX-License-Identifier: LGPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | #include "unit_p.h" |
| 10 | #include "voltage_p.h" |
| 11 | |
| 12 | #include <KLocalizedString> |
| 13 | |
| 14 | namespace KUnitConversion |
| 15 | { |
| 16 | UnitCategory Voltage::makeCategory() |
| 17 | { |
| 18 | auto c = UnitCategoryPrivate::makeCategory(id: VoltageCategory, i18n("Voltage" ), i18n("Voltage" )); |
| 19 | auto d = UnitCategoryPrivate::get(category: c); |
| 20 | KLocalizedString symbolString = ki18nc("%1 value, %2 unit symbol (voltage" , "%1 %2" ); |
| 21 | |
| 22 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 23 | id: Yottavolts, |
| 24 | multiplier: 1e+24, |
| 25 | i18nc("voltage unit symbol" , "YV" ), |
| 26 | i18nc("unit description in lists" , "yottavolts" ), |
| 27 | i18nc("unit synonyms for matching user input" , "yottavolt;yottavolts;YV" ), |
| 28 | symbolString, |
| 29 | ki18nc("amount in units (real)" , "%1 yottavolts" ), |
| 30 | ki18ncp("amount in units (integer)" , "%1 yottavolt" , "%1 yottavolts" ))); |
| 31 | |
| 32 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 33 | id: Zettavolts, |
| 34 | multiplier: 1e+21, |
| 35 | i18nc("voltage unit symbol" , "ZV" ), |
| 36 | i18nc("unit description in lists" , "zettavolts" ), |
| 37 | i18nc("unit synonyms for matching user input" , "zettavolt;zettavolts;ZV" ), |
| 38 | symbolString, |
| 39 | ki18nc("amount in units (real)" , "%1 zettavolts" ), |
| 40 | ki18ncp("amount in units (integer)" , "%1 zettavolt" , "%1 zettavolts" ))); |
| 41 | |
| 42 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 43 | id: Exavolts, |
| 44 | multiplier: 1e+18, |
| 45 | i18nc("voltage unit symbol" , "EV" ), |
| 46 | i18nc("unit description in lists" , "exavolts" ), |
| 47 | i18nc("unit synonyms for matching user input" , "exavolt;exavolts;EV" ), |
| 48 | symbolString, |
| 49 | ki18nc("amount in units (real)" , "%1 exavolts" ), |
| 50 | ki18ncp("amount in units (integer)" , "%1 exavolt" , "%1 exavolts" ))); |
| 51 | |
| 52 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 53 | id: Petavolts, |
| 54 | multiplier: 1e+15, |
| 55 | i18nc("voltage unit symbol" , "PV" ), |
| 56 | i18nc("unit description in lists" , "petavolts" ), |
| 57 | i18nc("unit synonyms for matching user input" , "petavolt;petavolts;PV" ), |
| 58 | symbolString, |
| 59 | ki18nc("amount in units (real)" , "%1 petavolts" ), |
| 60 | ki18ncp("amount in units (integer)" , "%1 petavolt" , "%1 petavolts" ))); |
| 61 | |
| 62 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 63 | id: Teravolts, |
| 64 | multiplier: 1e+12, |
| 65 | i18nc("voltage unit symbol" , "TV" ), |
| 66 | i18nc("unit description in lists" , "teravolts" ), |
| 67 | i18nc("unit synonyms for matching user input" , "teravolt;teravolts;TV" ), |
| 68 | symbolString, |
| 69 | ki18nc("amount in units (real)" , "%1 teravolts" ), |
| 70 | ki18ncp("amount in units (integer)" , "%1 teravolt" , "%1 teravolts" ))); |
| 71 | |
| 72 | d->addCommonUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 73 | id: Gigavolts, |
| 74 | multiplier: 1e+09, |
| 75 | i18nc("voltage unit symbol" , "GV" ), |
| 76 | i18nc("unit description in lists" , "gigavolts" ), |
| 77 | i18nc("unit synonyms for matching user input" , "gigavolt;gigavolts;GV" ), |
| 78 | symbolString, |
| 79 | ki18nc("amount in units (real)" , "%1 gigavolts" ), |
| 80 | ki18ncp("amount in units (integer)" , "%1 gigavolt" , "%1 gigavolts" ))); |
| 81 | |
| 82 | d->addCommonUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 83 | id: Megavolts, |
| 84 | multiplier: 1e+06, |
| 85 | i18nc("voltage unit symbol" , "MV" ), |
| 86 | i18nc("unit description in lists" , "megavolts" ), |
| 87 | i18nc("unit synonyms for matching user input" , "megavolt;megavolts;MV" ), |
| 88 | symbolString, |
| 89 | ki18nc("amount in units (real)" , "%1 megavolts" ), |
| 90 | ki18ncp("amount in units (integer)" , "%1 megavolt" , "%1 megavolts" ))); |
| 91 | |
| 92 | d->addCommonUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 93 | id: Kilovolts, |
| 94 | multiplier: 1000, |
| 95 | i18nc("voltage unit symbol" , "kV" ), |
| 96 | i18nc("unit description in lists" , "kilovolts" ), |
| 97 | i18nc("unit synonyms for matching user input" , "kilovolt;kilovolts;kV" ), |
| 98 | symbolString, |
| 99 | ki18nc("amount in units (real)" , "%1 kilovolts" ), |
| 100 | ki18ncp("amount in units (integer)" , "%1 kilovolt" , "%1 kilovolts" ))); |
| 101 | |
| 102 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 103 | id: Hectovolts, |
| 104 | multiplier: 100, |
| 105 | i18nc("voltage unit symbol" , "hV" ), |
| 106 | i18nc("unit description in lists" , "hectovolts" ), |
| 107 | i18nc("unit synonyms for matching user input" , "hectovolt;hectovolts;hV" ), |
| 108 | symbolString, |
| 109 | ki18nc("amount in units (real)" , "%1 hectovolts" ), |
| 110 | ki18ncp("amount in units (integer)" , "%1 hectovolt" , "%1 hectovolts" ))); |
| 111 | |
| 112 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 113 | id: Decavolts, |
| 114 | multiplier: 10, |
| 115 | i18nc("voltage unit symbol" , "daV" ), |
| 116 | i18nc("unit description in lists" , "decavolts" ), |
| 117 | i18nc("unit synonyms for matching user input" , "decavolt;decavolts;daV" ), |
| 118 | symbolString, |
| 119 | ki18nc("amount in units (real)" , "%1 decavolts" ), |
| 120 | ki18ncp("amount in units (integer)" , "%1 decavolt" , "%1 decavolts" ))); |
| 121 | |
| 122 | d->addDefaultUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 123 | id: Volts, |
| 124 | multiplier: 1, |
| 125 | i18nc("voltage unit symbol" , "V" ), |
| 126 | i18nc("unit description in lists" , "volts" ), |
| 127 | i18nc("unit synonyms for matching user input" , "volt;volts;V" ), |
| 128 | symbolString, |
| 129 | ki18nc("amount in units (real)" , "%1 volts" ), |
| 130 | ki18ncp("amount in units (integer)" , "%1 volt" , "%1 volts" ))); |
| 131 | |
| 132 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 133 | id: Decivolts, |
| 134 | multiplier: 0.1, |
| 135 | i18nc("voltage unit symbol" , "dV" ), |
| 136 | i18nc("unit description in lists" , "decivolts" ), |
| 137 | i18nc("unit synonyms for matching user input" , "decivolt;decivolts;dV" ), |
| 138 | symbolString, |
| 139 | ki18nc("amount in units (real)" , "%1 decivolts" ), |
| 140 | ki18ncp("amount in units (integer)" , "%1 decivolt" , "%1 decivolts" ))); |
| 141 | |
| 142 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 143 | id: Centivolts, |
| 144 | multiplier: 0.01, |
| 145 | i18nc("voltage unit symbol" , "cV" ), |
| 146 | i18nc("unit description in lists" , "centivolts" ), |
| 147 | i18nc("unit synonyms for matching user input" , "centivolt;centivolts;cV" ), |
| 148 | symbolString, |
| 149 | ki18nc("amount in units (real)" , "%1 centivolts" ), |
| 150 | ki18ncp("amount in units (integer)" , "%1 centivolt" , "%1 centivolts" ))); |
| 151 | |
| 152 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 153 | id: Millivolts, |
| 154 | multiplier: 0.001, |
| 155 | i18nc("voltage unit symbol" , "mV" ), |
| 156 | i18nc("unit description in lists" , "millivolts" ), |
| 157 | i18nc("unit synonyms for matching user input" , "millivolt;millivolts;mV" ), |
| 158 | symbolString, |
| 159 | ki18nc("amount in units (real)" , "%1 millivolts" ), |
| 160 | ki18ncp("amount in units (integer)" , "%1 millivolt" , "%1 millivolts" ))); |
| 161 | |
| 162 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 163 | id: Microvolts, |
| 164 | multiplier: 1e-06, |
| 165 | i18nc("voltage unit symbol" , "µV" ), |
| 166 | i18nc("unit description in lists" , "microvolts" ), |
| 167 | i18nc("unit synonyms for matching user input" , "microvolt;microvolts;µV;uV" ), |
| 168 | symbolString, |
| 169 | ki18nc("amount in units (real)" , "%1 microvolts" ), |
| 170 | ki18ncp("amount in units (integer)" , "%1 microvolt" , "%1 microvolts" ))); |
| 171 | |
| 172 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 173 | id: Nanovolts, |
| 174 | multiplier: 1e-09, |
| 175 | i18nc("voltage unit symbol" , "nV" ), |
| 176 | i18nc("unit description in lists" , "nanovolts" ), |
| 177 | i18nc("unit synonyms for matching user input" , "nanovolt;nanovolts;nV" ), |
| 178 | symbolString, |
| 179 | ki18nc("amount in units (real)" , "%1 nanovolts" ), |
| 180 | ki18ncp("amount in units (integer)" , "%1 nanovolt" , "%1 nanovolts" ))); |
| 181 | |
| 182 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 183 | id: Picovolts, |
| 184 | multiplier: 1e-12, |
| 185 | i18nc("voltage unit symbol" , "pV" ), |
| 186 | i18nc("unit description in lists" , "picovolts" ), |
| 187 | i18nc("unit synonyms for matching user input" , "picovolt;picovolts;pV" ), |
| 188 | symbolString, |
| 189 | ki18nc("amount in units (real)" , "%1 picovolts" ), |
| 190 | ki18ncp("amount in units (integer)" , "%1 picovolt" , "%1 picovolts" ))); |
| 191 | |
| 192 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 193 | id: Femtovolts, |
| 194 | multiplier: 1e-15, |
| 195 | i18nc("voltage unit symbol" , "fV" ), |
| 196 | i18nc("unit description in lists" , "femtovolts" ), |
| 197 | i18nc("unit synonyms for matching user input" , "femtovolt;femtovolts;fV" ), |
| 198 | symbolString, |
| 199 | ki18nc("amount in units (real)" , "%1 femtovolts" ), |
| 200 | ki18ncp("amount in units (integer)" , "%1 femtovolt" , "%1 femtovolts" ))); |
| 201 | |
| 202 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 203 | id: Attovolts, |
| 204 | multiplier: 1e-18, |
| 205 | i18nc("voltage unit symbol" , "aV" ), |
| 206 | i18nc("unit description in lists" , "attovolts" ), |
| 207 | i18nc("unit synonyms for matching user input" , "attovolt;attovolts;aV" ), |
| 208 | symbolString, |
| 209 | ki18nc("amount in units (real)" , "%1 attovolts" ), |
| 210 | ki18ncp("amount in units (integer)" , "%1 attovolt" , "%1 attovolts" ))); |
| 211 | |
| 212 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 213 | id: Zeptovolts, |
| 214 | multiplier: 1e-21, |
| 215 | i18nc("voltage unit symbol" , "zV" ), |
| 216 | i18nc("unit description in lists" , "zeptovolts" ), |
| 217 | i18nc("unit synonyms for matching user input" , "zeptovolt;zeptovolts;zV" ), |
| 218 | symbolString, |
| 219 | ki18nc("amount in units (real)" , "%1 zeptovolts" ), |
| 220 | ki18ncp("amount in units (integer)" , "%1 zeptovolt" , "%1 zeptovolts" ))); |
| 221 | |
| 222 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 223 | id: Yoctovolts, |
| 224 | multiplier: 1e-24, |
| 225 | i18nc("voltage unit symbol" , "yV" ), |
| 226 | i18nc("unit description in lists" , "yoctovolts" ), |
| 227 | i18nc("unit synonyms for matching user input" , "yoctovolt;yoctovolts;yV" ), |
| 228 | symbolString, |
| 229 | ki18nc("amount in units (real)" , "%1 yoctovolts" ), |
| 230 | ki18ncp("amount in units (integer)" , "%1 yoctovolt" , "%1 yoctovolts" ))); |
| 231 | |
| 232 | d->addUnit(unit: UnitPrivate::makeUnit(categoryId: VoltageCategory, |
| 233 | id: Statvolts, |
| 234 | multiplier: 299.792458, |
| 235 | i18nc("voltage unit symbol" , "stV" ), |
| 236 | i18nc("unit description in lists" , "statvolts" ), |
| 237 | i18nc("unit synonyms for matching user input" , "statvolt;statvolts;stV" ), |
| 238 | symbolString, |
| 239 | ki18nc("amount in units (real)" , "%1 statvolts" ), |
| 240 | ki18ncp("amount in units (integer)" , "%1 statvolt" , "%1 statvolts" ))); |
| 241 | |
| 242 | return c; |
| 243 | } |
| 244 | |
| 245 | } // KUnitConversion namespace |
| 246 | |