Skip to content

Commit

Permalink
GUI: Support translating Bitcoin units
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Jun 29, 2023
1 parent bbbf89a commit 1476090
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions src/qt/bitcoinunits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,44 @@ QList<BitcoinUnit> BitcoinUnits::availableUnits()
QString BitcoinUnits::longName(Unit unit)
{
switch (unit) {
case Unit::BTC: return QString("BTC");
case Unit::mBTC: return QString("mBTC");
case Unit::uBTC: return QString::fromUtf8("µBTC (bits)");
case Unit::SAT: return QString("Satoshi (sat)");
//: "BTC" as a unit name in dropbox selector
case Unit::BTC: return tr("BTC", "long unit name");
//: "mBTC" as a unit name in dropbox selector
case Unit::mBTC: return tr("mBTC", "long unit name");
//: "µBTC" as a unit name in dropbox selector
case Unit::uBTC: return tr("µBTC (bits)", "long unit name");
//: Base unit name in dropbox selector
case Unit::SAT: return tr("Satoshi (sat)", "long unit name");
} // no default case, so the compiler can warn about missing cases
assert(false);
}

QString BitcoinUnits::shortName(Unit unit)
{
switch (unit) {
case Unit::BTC: return longName(unit);
case Unit::mBTC: return longName(unit);
case Unit::uBTC: return QString("bits");
case Unit::SAT: return QString("sat");
//: "BTC" as a unit suffix
case Unit::BTC: return tr("BTC", "unit suffix");
//: "mBTC" as a unit suffix
case Unit::mBTC: return tr("mBTC", "unit suffix");
//: "µBTC" as a unit suffix
case Unit::uBTC: return tr("bits", "unit suffix");
//: Base unit suffix
case Unit::SAT: return tr("sat", "unit suffix");
} // no default case, so the compiler can warn about missing cases
assert(false);
}

QString BitcoinUnits::description(Unit unit)
{
switch (unit) {
case Unit::BTC: return QString("Bitcoins");
case Unit::mBTC: return QString("Milli-Bitcoins (1 / 1" THIN_SP_UTF8 "000)");
case Unit::uBTC: return QString("Micro-Bitcoins (bits) (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)");
case Unit::SAT: return QString("Satoshi (sat) (1 / 100" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)");
//: Tooltip description of "BTC" unit in dropbox selector
case Unit::BTC: return tr("Bitcoins", "unit description");
//: Tooltip description of "mBTC" unit in dropbox selector
case Unit::mBTC: return tr("Milli-Bitcoins (1 / 1" THIN_SP_UTF8 "000)", "unit description");
//: Tooltip description of "µBTC" unit in dropbox selector
case Unit::uBTC: return tr("Micro-Bitcoins (bits) (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)", "unit description");
//: Tooltip description of base unit in dropbox selector
case Unit::SAT: return tr("Satoshi (sat) (1 / 100" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)", "unit description");
} // no default case, so the compiler can warn about missing cases
assert(false);
}
Expand Down

0 comments on commit 1476090

Please sign in to comment.