Launcher: fix L10N issues found by Michael D
Address parts of the issues mentioned in: https://sourceforge.net/p/flightgear/codetickets/2386/
This commit is contained in:
parent
29d171e73a
commit
6d2f1d33d8
4 changed files with 51 additions and 41 deletions
|
@ -1042,24 +1042,25 @@ void LocationController::setNavRadioOption()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString compassPointFromHeading(int heading)
|
QString LocationController::compassPointFromHeading(int heading) const
|
||||||
{
|
{
|
||||||
const int labelArc = 360 / 8;
|
const int labelArc = 360 / 8;
|
||||||
heading += (labelArc >> 1);
|
heading += (labelArc >> 1);
|
||||||
SG_NORMALIZE_RANGE(heading, 0, 359);
|
SG_NORMALIZE_RANGE(heading, 0, 359);
|
||||||
|
|
||||||
|
//
|
||||||
switch (heading / labelArc) {
|
switch (heading / labelArc) {
|
||||||
case 0: return "N";
|
case 0: return tr("N");
|
||||||
case 1: return "NE";
|
case 1: return tr("NE");
|
||||||
case 2: return "E";
|
case 2: return tr("E");
|
||||||
case 3: return "SE";
|
case 3: return tr("SE");
|
||||||
case 4: return "S";
|
case 4: return tr("S");
|
||||||
case 5: return "SW";
|
case 5: return tr("SW");
|
||||||
case 6: return "W";
|
case 6: return tr("W");
|
||||||
case 7: return "NW";
|
case 7: return tr("NW");
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LocationController::description() const
|
QString LocationController::description() const
|
||||||
|
@ -1112,7 +1113,7 @@ QString LocationController::description() const
|
||||||
} else if (m_useAvailableParking) {
|
} else if (m_useAvailableParking) {
|
||||||
locationOnAirport = tr("at an available parking position");
|
locationOnAirport = tr("at an available parking position");
|
||||||
} else if (onRunway) {
|
} else if (onRunway) {
|
||||||
QString runwayName = QString("runway %1").arg(QString::fromStdString(m_detailLocation->ident()));
|
QString runwayName = tr("runway %1").arg(QString::fromStdString(m_detailLocation->ident()));
|
||||||
|
|
||||||
if (m_onFinal) {
|
if (m_onFinal) {
|
||||||
locationOnAirport = tr("on %2-mile final to %1").arg(runwayName).arg(offsetNm);
|
locationOnAirport = tr("on %2-mile final to %1").arg(runwayName).arg(offsetNm);
|
||||||
|
|
|
@ -237,6 +237,8 @@ private:
|
||||||
void applyAirspeed();
|
void applyAirspeed();
|
||||||
void applyOnFinal();
|
void applyOnFinal();
|
||||||
|
|
||||||
|
QString compassPointFromHeading(int heading) const;
|
||||||
|
|
||||||
NavaidSearchModel* m_searchModel = nullptr;
|
NavaidSearchModel* m_searchModel = nullptr;
|
||||||
CarriersLocationModel* m_carriersModel = nullptr;
|
CarriersLocationModel* m_carriersModel = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -30,18 +30,19 @@
|
||||||
#include <QDoubleValidator>
|
#include <QDoubleValidator>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
struct UnitData
|
struct UnitData
|
||||||
{
|
{
|
||||||
UnitData(QString sn, QString ln, QString metrics, bool pfx = false) :
|
UnitData(const char* sn, const char* ln, QString metrics, bool pfx = false) :
|
||||||
shortName(sn), longName(ln),
|
shortName(sn), longName(ln),
|
||||||
maxTextForMetrics(metrics),
|
maxTextForMetrics(metrics),
|
||||||
isPrefix(pfx) {}
|
isPrefix(pfx) {}
|
||||||
|
|
||||||
UnitData(QString sn, QString ln,
|
UnitData(const char* sn, const char* ln,
|
||||||
QString metrics,
|
QString metrics,
|
||||||
bool pfx,
|
bool pfx,
|
||||||
double min, double max,
|
double min, double max,
|
||||||
|
@ -56,8 +57,8 @@ struct UnitData
|
||||||
decimals(dps)
|
decimals(dps)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QString shortName;
|
const char* shortName;
|
||||||
QString longName;
|
const char* longName;
|
||||||
QString maxTextForMetrics;
|
QString maxTextForMetrics;
|
||||||
bool isPrefix = false;
|
bool isPrefix = false;
|
||||||
bool valueWraps = false;
|
bool valueWraps = false;
|
||||||
|
@ -69,23 +70,23 @@ struct UnitData
|
||||||
|
|
||||||
std::vector<UnitData> static_unitData = {
|
std::vector<UnitData> static_unitData = {
|
||||||
{ "", "", "" }, // noUnits
|
{ "", "", "" }, // noUnits
|
||||||
{ "ft", "feet above sea-level (MSL)", "000000", false, -2000, 180000, 50},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "ft"), QT_TRANSLATE_NOOP("UnitsModel", "feet above sea-level (MSL)"), "000000", false, -2000, 180000, 50},
|
||||||
{ "ft AGL", "feet above ground level (AGL)", "000000", false, 0, 180000, 50},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "ft AGL"), QT_TRANSLATE_NOOP("UnitsModel", "feet above ground level (AGL)"), "000000", false, 0, 180000, 50},
|
||||||
{ "ft above field", "feet above airfield", "000000", false, 0, 180000, 50},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "ft above field"), QT_TRANSLATE_NOOP("UnitsModel", "feet above airfield"), "000000", false, 0, 180000, 50},
|
||||||
{ "FL", "Flight-level", "000", true /* prefix */, 0.0, 500.0, 5.0},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "FL"), QT_TRANSLATE_NOOP("UnitsModel", "Flight-level"), "000", true /* prefix */, 0.0, 500.0, 5.0},
|
||||||
{ "m", "meters above sea-level (MSL)", "000000", false, -500, 100000, 50},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "m"), QT_TRANSLATE_NOOP("UnitsModel", "meters above sea-level (MSL)"), "000000", false, -500, 100000, 50},
|
||||||
{ "kts", "Knots", "9999", false, 0, 999999, 10.0},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "kts"), QT_TRANSLATE_NOOP("UnitsModel", "Knots"), "9999", false, 0, 999999, 10.0},
|
||||||
{ "M", "Mach", "00.000", true /* prefix */, 0.0, 99.0, 0.05, false /* no wrap */, 3 /* decimal places */},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "M"), QT_TRANSLATE_NOOP("UnitsModel", "Mach"), "00.000", true /* prefix */, 0.0, 99.0, 0.05, false /* no wrap */, 3 /* decimal places */},
|
||||||
{ "KM/H", "Kilometers/hour", "9999", false, 0, 999999, 10.0},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "KM/H"), QT_TRANSLATE_NOOP("UnitsModel", "Kilometers/hour"), "9999", false, 0, 999999, 10.0},
|
||||||
{ "°True", "degrees true", "000", false, 0, 359, 5.0, true /* wraps */},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "°True"), QT_TRANSLATE_NOOP("UnitsModel", "degrees true"), "000", false, 0, 359, 5.0, true /* wraps */},
|
||||||
{ "°Mag", "degrees magnetic", "000", false, 0, 359, 5.0, true /* wraps */},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "°Mag"), QT_TRANSLATE_NOOP("UnitsModel", "degrees magnetic"), "000", false, 0, 359, 5.0, true /* wraps */},
|
||||||
{ "UTC", "Universal coordinated time", ""},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "UTC"), QT_TRANSLATE_NOOP("UnitsModel", "Universal coordinated time"), ""},
|
||||||
{ "Local", "Local time", ""},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "Local"), QT_TRANSLATE_NOOP("UnitsModel", "Local time"), ""},
|
||||||
{ "Nm", "Nautical miles", "00000", false, 0, 999999, 1.0, false /* no wrap */, 1 /* decimal places */},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "Nm"), QT_TRANSLATE_NOOP("UnitsModel", "Nautical miles"), "00000", false, 0, 999999, 1.0, false /* no wrap */, 1 /* decimal places */},
|
||||||
{ "Km", "Kilometers", "00000", false, 0, 999999, 1.0, false /* no wrap */, 1 /* decimal places */},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "Km"), QT_TRANSLATE_NOOP("UnitsModel", "Kilometers"), "00000", false, 0, 999999, 1.0, false /* no wrap */, 1 /* decimal places */},
|
||||||
|
|
||||||
{ "MHz", "MHz", "00000", false, 105, 140, 0.025, false /* no wrap */, 3 /* decimal places */},
|
{ QT_TRANSLATE_NOOP("UnitsModel", "MHz"), QT_TRANSLATE_NOOP("UnitsModel", "MHz"), "00000", false, 105, 140, 0.025, false /* no wrap */, 3 /* decimal places */},
|
||||||
{ "KHz", "KHz", "00000", false, 200, 400, 1.0, false /* no wrap */, 0 /* decimal places */}
|
{ QT_TRANSLATE_NOOP("UnitsModel", "KHz"), QT_TRANSLATE_NOOP("UnitsModel", "KHz"), "00000", false, 200, 400, 1.0, false /* no wrap */, 0 /* decimal places */}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -115,6 +116,8 @@ const int UnitValueWrapsRole = Qt::UserRole + 7;
|
||||||
|
|
||||||
UnitsModel::UnitsModel()
|
UnitsModel::UnitsModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
m_enabledUnits = static_modeData.at(m_mode);
|
m_enabledUnits = static_modeData.at(m_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,8 +136,12 @@ QVariant UnitsModel::data(const QModelIndex &index, int role) const
|
||||||
const UnitData& ud = static_unitData.at(u);
|
const UnitData& ud = static_unitData.at(u);
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole: return ud.shortName;
|
case Qt::DisplayRole:
|
||||||
case UnitLongNameRole: return ud.longName;
|
return qApp->translate("UnitsModel", ud.shortName);
|
||||||
|
|
||||||
|
case UnitLongNameRole:
|
||||||
|
return qApp->translate("UnitsModel", ud.longName);
|
||||||
|
|
||||||
case UnitIsPrefixRole: return ud.isPrefix;
|
case UnitIsPrefixRole: return ud.isPrefix;
|
||||||
case UnitMinValueRole: return ud.minValue;
|
case UnitMinValueRole: return ud.minValue;
|
||||||
case UnitMaxValueRole: return ud.maxValue;
|
case UnitMaxValueRole: return ud.maxValue;
|
||||||
|
@ -189,7 +196,7 @@ QString UnitsModel::shortText() const
|
||||||
{
|
{
|
||||||
const auto u = m_enabledUnits.at(m_activeIndex);
|
const auto u = m_enabledUnits.at(m_activeIndex);
|
||||||
const UnitData& ud = static_unitData.at(u);
|
const UnitData& ud = static_unitData.at(u);
|
||||||
return ud.shortName;
|
return qApp->translate("UnitsModel",ud.shortName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Units::Type UnitsModel::selectedUnit() const
|
Units::Type UnitsModel::selectedUnit() const
|
||||||
|
@ -427,7 +434,7 @@ QString QuantityValue::toString() const
|
||||||
const auto& data = static_unitData.at(unit);
|
const auto& data = static_unitData.at(unit);
|
||||||
int dp = data.decimals;
|
int dp = data.decimals;
|
||||||
QString prefix;
|
QString prefix;
|
||||||
QString suffix = data.shortName;
|
QString suffix = qApp->translate("UnitsModel", data.shortName);
|
||||||
if (data.isPrefix)
|
if (data.isPrefix)
|
||||||
std::swap(prefix, suffix);
|
std::swap(prefix, suffix);
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,8 @@ Item {
|
||||||
function summary()
|
function summary()
|
||||||
{
|
{
|
||||||
var result = [];
|
var result = [];
|
||||||
if (startPaused.checked) result.push("paused");
|
if (startPaused.checked) result.push(qsTr("paused"));
|
||||||
if (!showConsoleWin.hidden && showConsoleWin.checked) result.push("console");
|
if (!showConsoleWin.hidden && showConsoleWin.checked) result.push(qsTr("console"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ Item {
|
||||||
function summary()
|
function summary()
|
||||||
{
|
{
|
||||||
var result = [];
|
var result = [];
|
||||||
if (enableMP.checked) result.push("multi-player");
|
if (enableMP.checked) result.push(qsTr("multi-player"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ Item {
|
||||||
function summary()
|
function summary()
|
||||||
{
|
{
|
||||||
var result = [];
|
var result = [];
|
||||||
if (terrasync.checked) result.push("scenery downloads");
|
if (terrasync.checked) result.push(qsTr("scenery downloads"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ Item {
|
||||||
function summary()
|
function summary()
|
||||||
{
|
{
|
||||||
var result = [];
|
var result = [];
|
||||||
if (fullscreen.checked) result.push("full-screen");
|
if (fullscreen.checked) result.push(qsTr("full-screen"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ Item {
|
||||||
{
|
{
|
||||||
var result = [];
|
var result = [];
|
||||||
if (rembrandt) result.push(qsTr("Rembrandt"));
|
if (rembrandt) result.push(qsTr("Rembrandt"));
|
||||||
else if (alsEnabled) result.push("ALS");
|
else if (alsEnabled) result.push(qsTr("ALS"));
|
||||||
if (msaaEnabled) result.push(qsTr("anti-aliasing"));
|
if (msaaEnabled) result.push(qsTr("anti-aliasing"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue