Skip to content

Commit

Permalink
[v0.6.3] Exoplanets plug-in (fix #3798)
Browse files Browse the repository at this point in the history
- Fixed translation issue for multiple detection methods for one exoplanet
- Fixed translation issue for exoplanetary classes of potentially habitable exoplanets
- Added context support for exoplanet detection methods and exoplanetary classes
  • Loading branch information
alex-w committed Jul 6, 2024
1 parent cc4b30f commit d6ba9ce
Show file tree
Hide file tree
Showing 5 changed files with 625 additions and 573 deletions.
2 changes: 1 addition & 1 deletion plugins/Exoplanets/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SET(EXOPLANETS_PLUGIN_MAJOR "0")
SET(EXOPLANETS_PLUGIN_MINOR "6")
SET(EXOPLANETS_PLUGIN_PATCH "2")
SET(EXOPLANETS_PLUGIN_PATCH "3")
SET(EXOPLANETS_VERSION "${EXOPLANETS_PLUGIN_MAJOR}.${EXOPLANETS_PLUGIN_MINOR}.${EXOPLANETS_PLUGIN_PATCH}")

ADD_DEFINITIONS(-DEXOPLANETS_PLUGIN_VERSION="${EXOPLANETS_VERSION}")
Expand Down
16 changes: 12 additions & 4 deletions plugins/Exoplanets/src/Exoplanet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,15 @@ QString Exoplanet::getInfoString(const StelCore* core, const InfoStringGroup& fl
if (p.detectionMethod.isEmpty())
detectionMethodLabel.append(emptyRow);
else
detectionMethodLabel.append(row.arg(q_(p.detectionMethod)));
{
QStringList dmlist = p.detectionMethod.split(",");
QStringList dmloc;
for (int i=0;i<dmlist.count();i++)
{
dmloc << qc_(dmlist.at(i).trimmed(), "Exoplanet detection method");
}
detectionMethodLabel.append(row.arg(dmloc.join(", ")));
}
}
oss << "<table style='margin-left: -2px;'>"; // Cosmetic fix
oss << "<tr>" << planetNameLabel << "</tr>";
Expand Down Expand Up @@ -566,15 +574,15 @@ QVariantMap Exoplanet::getInfoMap(const StelCore *core) const
QString Exoplanet::getPlanetaryClassI18n(QString ptype) const
{
QString result = "";
static const QRegularExpression dataRx("^(\\w)-(\\w+)\\s(\\w+)$");
static const QRegularExpression dataRx("^(\\w)[-\\s]+(\\w+)\\s(\\w+)$");
QRegularExpressionMatch dataMatch=dataRx.match(ptype);
if (dataMatch.hasMatch())
{
QString spectral = dataMatch.captured(1).trimmed();
QString spectral = dataMatch.captured(1).trimmed();
QString zone = dataMatch.captured(2).trimmed();
QString size = dataMatch.captured(3).trimmed();

result = QString("%1-%2 %3").arg(spectral, q_(zone), q_(size));
result = QString("%1-%2 %3").arg(spectral, qc_(zone, "Habitable zone"), qc_(size, "Exoplanet size"));
}
return result;
}
Expand Down
58 changes: 31 additions & 27 deletions plugins/Exoplanets/src/Exoplanets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,49 +1041,53 @@ void Exoplanets::translations()
{
#if 0
// TRANSLATORS: Habitable zone
N_("Hot");
NC_("Hot", "Habitable zone");
// TRANSLATORS: Habitable zone
N_("Warm");
NC_("Warm", "Habitable zone");
// TRANSLATORS: Habitable zone
N_("Cold");

// TRANSLATORS: Planet size
N_("Miniterran");
// TRANSLATORS: Planet size
N_("Subterran");
// TRANSLATORS: Planet size
N_("Terran");
// TRANSLATORS: Planet size
N_("Superterran");
// TRANSLATORS: Planet size
N_("Jovian");
// TRANSLATORS: Planet size
N_("Neptunian");
NC_("Cold", "Habitable zone");

// TRANSLATORS: Exoplanet size
NC_("Miniterran", "Exoplanet size");
// TRANSLATORS: Exoplanet size
NC_("Subterran", "Exoplanet size");
// TRANSLATORS: Exoplanet size
NC_("Terran", "Exoplanet size");
// TRANSLATORS: Exoplanet size
NC_("Superterran", "Exoplanet size");
// TRANSLATORS: Exoplanet size
NC_("Jovian", "Exoplanet size");
// TRANSLATORS: Exoplanet size
NC_("Neptunian", "Exoplanet size");

// TRANSLATORS: Exoplanet detection method
N_("Primary Transit");
NC_("Primary Transit", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method
N_("Microlensing");
NC_("Microlensing", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method
N_("Radial Velocity");
NC_("Radial Velocity", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method
N_("Imaging");
NC_("Imaging", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method
N_("Astrometry");
NC_("Astrometry", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method. TTV=Transit Timing Variation
N_("TTV");
NC_("TTV", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method
N_("Timing");
NC_("Timing", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method
N_("Default");
NC_("Default", "Exoplanet detection method");

This comment has been minimized.

Copy link
@gzotti

gzotti Jul 6, 2024

Member

What is the default method to detect exoplanets? If unknown, say "Unspecified" please.

This comment has been minimized.

Copy link
@alex-w

alex-w Jul 6, 2024

Author Member

These names are obtained from exoplanetary catalogue and I shouldn’t add some unused values. But probably it is time to revise the list of detection methods in the catalog.

// TRANSLATORS: Exoplanet detection method
N_("Secondary Transit");
NC_("Secondary Transit", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method
N_("Disk Kinematics");
NC_("Disk Kinematics", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method
NC_("Kinematic", "Exoplanet detection method");
// TRANSLATORS: Exoplanet detection method
NC_("Other", "Exoplanet detection method");

/* For copy/paste:
// TRANSLATORS:
N_("");
NC_("", "Exoplanet detection method");
*/

#endif
Expand Down
14 changes: 12 additions & 2 deletions plugins/Exoplanets/src/gui/ExoplanetsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,17 @@ void ExoplanetsDialog::fillExoplanetsTable()
for (auto &eps : map["exoplanets"].toList())
{
auto epdata = eps.toMap();
QString dm = epdata.contains("detectionMethod") ? epdata["detectionMethod"].toString().trimmed() : dash;
QString dm = dash;
if ( epdata.contains("detectionMethod"))
{
QStringList dmlist = epdata["detectionMethod"].toString().trimmed().split(",");
QStringList dmloc;
for (int i=0;i<dmlist.count();i++)
{
dmloc << qc_(dmlist.at(i).trimmed(), "Exoplanet detection method");
}
dm = dmloc.join(", ");
}
EPSTreeWidgetItem* treeItem = new EPSTreeWidgetItem(ui->exoplanetsTreeWidget);
treeItem->setText(EPSExoplanetName, QString("%1 %2").arg(trans.qtranslate(map["designation"].toString().trimmed()), epdata["planetName"].toString()).trimmed());
treeItem->setData(EPSExoplanetName, Qt::UserRole, map["designation"].toString());
Expand Down Expand Up @@ -246,7 +256,7 @@ void ExoplanetsDialog::fillExoplanetsTable()
treeItem->setText(EPSStarRadius, sradius);
treeItem->setToolTip(EPSStarRadius, q_("Radius of star in solar radii"));
treeItem->setTextAlignment(EPSStarRadius, Qt::AlignRight);
treeItem->setText(EPSExoplanetDetectionMethod, q_(dm));
treeItem->setText(EPSExoplanetDetectionMethod, dm);
treeItem->setToolTip(EPSExoplanetDetectionMethod, q_("Detection method of exoplanet"));
}
}
Expand Down
Loading

0 comments on commit d6ba9ce

Please sign in to comment.