Reformat the update-related text to better accommodate translations

This commit is contained in:
Alexander Babikov
2025-08-14 05:24:21 +05:00
parent 6141b780ec
commit ac24f107f3
28 changed files with 335 additions and 99 deletions

View File

@@ -28,12 +28,18 @@ UpdateDetails(const UpdateCheck::UpdateResult &updateResult, QWidget *parent) :
ui->setupUi(this);
ui->updateTitle->setText(tr("<b>An update to 86Box is available!</b>"));
QString currentVersionText;
QString releaseType = updateResult.channel == UpdateCheck::UpdateChannel::Stable ? tr("version") : tr("build");
if(!updateResult.currentVersion.isEmpty()) {
currentVersionText = tr("You are currently running %1 <b>%2</b>. ").arg(releaseType, updateResult.currentVersion);
QString latestVersionText;
if (updateResult.channel == UpdateCheck::UpdateChannel::Stable) {
currentVersionText = tr("You are currently running version <b>%1</b>.").arg(updateResult.currentVersion);
latestVersionText = tr("<b>Version %1</b> is now available.").arg(updateResult.latestVersion);
} else {
currentVersionText = tr("You are currently running build <b>%1</b>.").arg(updateResult.currentVersion);
latestVersionText = tr("<b>Build %1</b> is now available.").arg(updateResult.latestVersion);
}
if (updateResult.currentVersion.isEmpty())
currentVersionText = "";
const auto updateDetailsText = tr("<b>%1 %2</b> is now available. %3Would you like to visit the download page?").arg(releaseType[0].toUpper() + releaseType.mid(1), updateResult.latestVersion, currentVersionText);
const auto updateDetailsText = QString("%1 %2%3").arg(latestVersionText, currentVersionText.append(' '), tr("Would you like to visit the download page?"));
ui->updateDetails->setText(updateDetailsText);
if(updateResult.channel == UpdateCheck::UpdateChannel::Stable) {