Skip to content

Commit

Permalink
Merge branch 'message_formatting' into 'master'
Browse files Browse the repository at this point in the history
Do not include formatting spaces to localizable strings

See merge request OpenMW/openmw!3624
  • Loading branch information
Assumeru committed Dec 1, 2023
2 parents ee4993b + c5b16d1 commit 8d8e970
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 107 deletions.
6 changes: 3 additions & 3 deletions apps/launcher/importpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ void Launcher::ImportPage::on_importerButton_clicked()
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(
tr("<html><head/><body><p><b>Could not open or create %1 for writing </b></p> \
<p>Please make sure you have the right permissions \
and try again.</p></body></html>")
tr("<html><head/><body><p><b>Could not open or create %1 for writing </b></p>"
"<p>Please make sure you have the right permissions "
"and try again.</p></body></html>")
.arg(file.fileName()));
msgBox.exec();
return;
Expand Down
56 changes: 28 additions & 28 deletions apps/launcher/maindialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog()
if (!create_directories(userConfigDir))
{
cfgError(tr("Error opening OpenMW configuration file"),
tr("<br><b>Could not create directory %0</b><br><br> \
Please make sure you have the right permissions \
and try again.<br>")
tr("<br><b>Could not create directory %0</b><br><br>"
"Please make sure you have the right permissions "
"and try again.<br>")
.arg(Files::pathToQString(canonical(userConfigDir))));
return FirstRunDialogResultFailure;
}
Expand All @@ -136,10 +136,10 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog()
msgBox.setIcon(QMessageBox::Question);
msgBox.setStandardButtons(QMessageBox::NoButton);
msgBox.setText(
tr("<html><head/><body><p><b>Welcome to OpenMW!</b></p> \
<p>It is recommended to run the Installation Wizard.</p> \
<p>The Wizard will let you select an existing Morrowind installation, \
or install Morrowind for OpenMW to use.</p></body></html>"));
tr("<html><head/><body><p><b>Welcome to OpenMW!</b></p>"
"<p>It is recommended to run the Installation Wizard.</p>"
"<p>The Wizard will let you select an existing Morrowind installation, "
"or install Morrowind for OpenMW to use.</p></body></html>"));

QAbstractButton* wizardButton
= msgBox.addButton(tr("Run &Installation Wizard"), QMessageBox::AcceptRole); // ActionRole doesn't work?!
Expand Down Expand Up @@ -297,9 +297,9 @@ bool Launcher::MainDialog::setupLauncherSettings()
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
cfgError(tr("Error opening OpenMW configuration file"),
tr("<br><b>Could not open %0 for reading:</b><br><br>%1<br><br> \
Please make sure you have the right permissions \
and try again.<br>")
tr("<br><b>Could not open %0 for reading:</b><br><br>%1<br><br>"
"Please make sure you have the right permissions "
"and try again.<br>")
.arg(file.fileName())
.arg(file.errorString()));
return false;
Expand Down Expand Up @@ -327,9 +327,9 @@ bool Launcher::MainDialog::setupGameSettings()
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
cfgError(tr("Error opening OpenMW configuration file"),
tr("<br><b>Could not open %0 for reading</b><br><br> \
Please make sure you have the right permissions \
and try again.<br>")
tr("<br><b>Could not open %0 for reading</b><br><br>"
"Please make sure you have the right permissions "
"and try again.<br>")
.arg(file.fileName()));
return {};
}
Expand Down Expand Up @@ -388,8 +388,8 @@ bool Launcher::MainDialog::setupGameData()
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::NoButton);
msgBox.setText(
tr("<br><b>Could not find the Data Files location</b><br><br> \
The directory containing the data files was not found."));
tr("<br><b>Could not find the Data Files location</b><br><br>"
"The directory containing the data files was not found."));

QAbstractButton* wizardButton = msgBox.addButton(tr("Run &Installation Wizard..."), QMessageBox::ActionRole);
QAbstractButton* skipButton = msgBox.addButton(tr("Skip"), QMessageBox::RejectRole);
Expand Down Expand Up @@ -419,8 +419,8 @@ bool Launcher::MainDialog::setupGraphicsSettings()
catch (std::exception& e)
{
cfgError(tr("Error reading OpenMW configuration files"),
tr("<br>The problem may be due to an incomplete installation of OpenMW.<br> \
Reinstalling OpenMW may resolve the problem.<br>")
tr("<br>The problem may be due to an incomplete installation of OpenMW.<br>"
"Reinstalling OpenMW may resolve the problem.<br>")
+ e.what());
return false;
}
Expand Down Expand Up @@ -460,9 +460,9 @@ bool Launcher::MainDialog::writeSettings()
if (!create_directories(userPath))
{
cfgError(tr("Error creating OpenMW configuration directory"),
tr("<br><b>Could not create %0</b><br><br> \
Please make sure you have the right permissions \
and try again.<br>")
tr("<br><b>Could not create %0</b><br><br>"
"Please make sure you have the right permissions "
"and try again.<br>")
.arg(Files::pathToQString(userPath)));
return false;
}
Expand All @@ -479,9 +479,9 @@ bool Launcher::MainDialog::writeSettings()
{
// File cannot be opened or created
cfgError(tr("Error writing OpenMW configuration file"),
tr("<br><b>Could not open or create %0 for writing</b><br><br> \
Please make sure you have the right permissions \
and try again.<br>")
tr("<br><b>Could not open or create %0 for writing</b><br><br>"
"Please make sure you have the right permissions "
"and try again.<br>")
.arg(file.fileName()));
return false;
}
Expand Down Expand Up @@ -510,9 +510,9 @@ bool Launcher::MainDialog::writeSettings()
{
// File cannot be opened or created
cfgError(tr("Error writing Launcher configuration file"),
tr("<br><b>Could not open or create %0 for writing</b><br><br> \
Please make sure you have the right permissions \
and try again.<br>")
tr("<br><b>Could not open or create %0 for writing</b><br><br>"
"Please make sure you have the right permissions "
"and try again.<br>")
.arg(file.fileName()));
return false;
}
Expand Down Expand Up @@ -562,8 +562,8 @@ void Launcher::MainDialog::play()
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(
tr("<br><b>You do not have a game file selected.</b><br><br> \
OpenMW will not start without a game file selected.<br>"));
tr("<br><b>You do not have a game file selected.</b><br><br>"
"OpenMW will not start without a game file selected.<br>"));
msgBox.exec();
return;
}
Expand Down
8 changes: 4 additions & 4 deletions apps/wizard/componentselectionpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ bool Wizard::ComponentSelectionPage::validatePage()
msgBox.setIcon(QMessageBox::Information);
msgBox.setStandardButtons(QMessageBox::Cancel);
msgBox.setText(
tr("<html><head/><body><p><b>You are about to install Tribunal</b></p> \
<p>Bloodmoon is already installed on your computer.</p> \
<p>However, it is recommended that you install Tribunal before Bloodmoon.</p> \
<p>Would you like to re-install Bloodmoon?</p></body></html>"));
tr("<html><head/><body><p><b>You are about to install Tribunal</b></p>"
"<p>Bloodmoon is already installed on your computer.</p>"
"<p>However, it is recommended that you install Tribunal before Bloodmoon.</p>"
"<p>Would you like to re-install Bloodmoon?</p></body></html>"));

QAbstractButton* reinstallButton
= msgBox.addButton(tr("Re-install &Bloodmoon"), QMessageBox::ActionRole);
Expand Down
17 changes: 9 additions & 8 deletions apps/wizard/conclusionpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,23 @@ void Wizard::ConclusionPage::initializePage()
if (field(QLatin1String("installation.retailDisc")).toBool() == true)
{
textLabel->setText(
tr("<html><head/><body><p>The OpenMW Wizard successfully installed Morrowind on your computer.</p> \
<p>Click Finish to close the Wizard.</p></body></html>"));
tr("<html><head/><body><p>The OpenMW Wizard successfully installed Morrowind on your computer.</p>"
"<p>Click Finish to close the Wizard.</p></body></html>"));
}
else
{
textLabel->setText(tr(
"<html><head/><body><p>The OpenMW Wizard successfully modified your existing Morrowind installation.</p> \
<p>Click Finish to close the Wizard.</p></body></html>"));
textLabel->setText(
tr("<html><head/><body><p>The OpenMW Wizard successfully modified your existing Morrowind "
"installation.</p><p>Click Finish to close the Wizard.</p></body></html>"));
}
}
else
{
textLabel->setText(
tr("<html><head/><body><p>The OpenMW Wizard failed to install Morrowind on your computer.</p> \
<p>Please report any bugs you might have encountered to our \
<a href=\"https://gitlab.com/OpenMW/openmw/issues\">bug tracker</a>.<br/>Make sure to include the installation log.</p><br/></body></html>"));
tr("<html><head/><body><p>The OpenMW Wizard failed to install Morrowind on your computer.</p>"
"<p>Please report any bugs you might have encountered to our "
"<a href=\"https://gitlab.com/OpenMW/openmw/issues\">bug tracker</a>.<br/>Make sure to include the "
"installation log.</p><br/></body></html>"));
}
}

Expand Down
14 changes: 7 additions & 7 deletions apps/wizard/existinginstallationpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ bool Wizard::ExistingInstallationPage::validatePage()
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Cancel);
msgBox.setText(
QObject::tr("<br><b>Could not find Morrowind.ini</b><br><br> \
The Wizard needs to update settings in this file.<br><br> \
Press \"Browse...\" to specify the location manually.<br>"));
QObject::tr("<br><b>Could not find Morrowind.ini</b><br><br>"
"The Wizard needs to update settings in this file.<br><br>"
"Press \"Browse...\" to specify the location manually.<br>"));

QAbstractButton* browseButton2 = msgBox.addButton(QObject::tr("B&rowse..."), QMessageBox::ActionRole);

Expand Down Expand Up @@ -107,8 +107,8 @@ void Wizard::ExistingInstallationPage::on_browseButton_clicked()
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(
QObject::tr("<b>Morrowind.bsa</b> is missing!<br>\
Make sure your Morrowind installation is complete."));
QObject::tr("<b>Morrowind.bsa</b> is missing!<br>"
"Make sure your Morrowind installation is complete."));
msgBox.exec();
return;
}
Expand Down Expand Up @@ -187,8 +187,8 @@ bool Wizard::ExistingInstallationPage::versionIsOK(QString directory_name)
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
msgBox.setText(
QObject::tr("<br><b>There may be a more recent version of Morrowind available.</b><br><br>\
Do you wish to continue anyway?<br>"));
QObject::tr("<br><b>There may be a more recent version of Morrowind available.</b><br><br>"
"Do you wish to continue anyway?<br>"));
int ret = msgBox.exec();
if (ret == QMessageBox::Yes)
{
Expand Down
24 changes: 9 additions & 15 deletions apps/wizard/installationpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ void Wizard::InstallationPage::showFileDialog(Wizard::Component component)
if (path.isEmpty())
{
logTextEdit->appendHtml(
tr("<p><br/><span style=\"color:red;\"> \
<b>Error: The installation was aborted by the user</b></span></p>"));
tr("<p><br/><span style=\"color:red;\">"
"<b>Error: The installation was aborted by the user</b></span></p>"));

mWizard->addLogText(QLatin1String("Error: The installation was aborted by the user"));
mWizard->mError = true;
Expand Down Expand Up @@ -205,8 +205,8 @@ void Wizard::InstallationPage::showOldVersionDialog()
if (ret == QMessageBox::No)
{
logTextEdit->appendHtml(
tr("<p><br/><span style=\"color:red;\"> \
<b>Error: The installation was aborted by the user</b></span></p>"));
tr("<p><br/><span style=\"color:red;\">"
"<b>Error: The installation was aborted by the user</b></span></p>"));

mWizard->addLogText(QLatin1String("Error: The installation was aborted by the user"));
mWizard->mError = true;
Expand Down Expand Up @@ -236,14 +236,8 @@ void Wizard::InstallationPage::installationError(const QString& text, const QStr
{
installProgressLabel->setText(tr("Installation failed!"));

logTextEdit->appendHtml(
tr("<p><br/><span style=\"color:red;\"> \
<b>Error: %1</b></p>")
.arg(text));
logTextEdit->appendHtml(
tr("<p><span style=\"color:red;\"> \
<b>%1</b></p>")
.arg(details));
logTextEdit->appendHtml(tr("<p><br/><span style=\"color:red;\"><b>Error: %1</b></p>").arg(text));
logTextEdit->appendHtml(tr("<p><span style=\"color:red;\"><b>%1</b></p>").arg(details));

mWizard->addLogText(QLatin1String("Error: ") + text);
mWizard->addLogText(details);
Expand All @@ -254,9 +248,9 @@ void Wizard::InstallationPage::installationError(const QString& text, const QStr
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(
tr("<html><head/><body><p><b>The Wizard has encountered an error</b></p> \
<p>The error reported was:</p><p>%1</p> \
<p>Press &quot;Show Details...&quot; for more information.</p></body></html>")
tr("<html><head/><body><p><b>The Wizard has encountered an error</b></p>"
"<p>The error reported was:</p><p>%1</p>"
"<p>Press &quot;Show Details...&quot; for more information.</p></body></html>")
.arg(text));

msgBox.setDetailedText(details);
Expand Down
19 changes: 10 additions & 9 deletions apps/wizard/installationtargetpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ bool Wizard::InstallationTargetPage::validatePage()
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(
tr("<html><head/><body><p><b>Could not create the destination directory</b></p> \
<p>Please make sure you have the right permissions \
and try again, or specify a different location.</p></body></html>"));
tr("<html><head/><body><p><b>Could not create the destination directory</b></p>"
"<p>Please make sure you have the right permissions "
"and try again, or specify a different location.</p></body></html>"));
msgBox.exec();
return false;
}
Expand All @@ -65,9 +65,9 @@ bool Wizard::InstallationTargetPage::validatePage()
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(
tr("<html><head/><body><p><b>Could not write to the destination directory</b></p> \
<p>Please make sure you have the right permissions \
and try again, or specify a different location.</p></body></html>"));
tr("<html><head/><body><p><b>Could not write to the destination directory</b></p>"
"<p>Please make sure you have the right permissions "
"and try again, or specify a different location.</p></body></html>"));
msgBox.exec();
return false;
}
Expand All @@ -79,9 +79,10 @@ bool Wizard::InstallationTargetPage::validatePage()
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(
tr("<html><head/><body><p><b>The destination directory is not empty</b></p> \
<p>An existing Morrowind installation is present in the specified location.</p> \
<p>Please specify a different location, or go back and select the location as an existing installation.</p></body></html>"));
tr("<html><head/><body><p><b>The destination directory is not empty</b></p>"
"<p>An existing Morrowind installation is present in the specified location.</p>"
"<p>Please specify a different location, or go back and select the location as an existing "
"installation.</p></body></html>"));
msgBox.exec();
return false;
}
Expand Down
Loading

0 comments on commit 8d8e970

Please sign in to comment.