Localize screenshot messages

pull/3234/head
Andrei Kortunov 11 months ago
parent 66b2d428c8
commit 6760fa4945

@ -14,6 +14,7 @@
#include <components/debug/gldebug.hpp> #include <components/debug/gldebug.hpp>
#include <components/misc/rng.hpp> #include <components/misc/rng.hpp>
#include <components/misc/strings/format.hpp>
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
#include <components/vfs/registerarchives.hpp> #include <components/vfs/registerarchives.hpp>
@ -109,10 +110,23 @@ namespace
profiler.removeUserStatsLine(" -Async"); profiler.removeUserStatsLine(" -Async");
} }
struct ScheduleNonDialogMessageBox struct ScreenCaptureMessageBox
{ {
void operator()(std::string message) const void operator()(std::string filePath) const
{ {
if (filePath.empty())
{
MWBase::Environment::get().getWindowManager()->scheduleMessageBox(
"#{OMWEngine:ScreenshotFailed}", MWGui::ShowInDialogueMode_Never);
return;
}
std::string messageFormat
= MWBase::Environment::get().getL10nManager()->getMessage("OMWEngine", "ScreenshotMade");
std::string message = Misc::StringUtils::format(messageFormat, filePath);
MWBase::Environment::get().getWindowManager()->scheduleMessageBox( MWBase::Environment::get().getWindowManager()->scheduleMessageBox(
std::move(message), MWGui::ShowInDialogueMode_Never); std::move(message), MWGui::ShowInDialogueMode_Never);
} }
@ -717,8 +731,7 @@ void OMW::Engine::prepareEngine()
mScreenCaptureOperation = new SceneUtil::AsyncScreenCaptureOperation(mWorkQueue, mScreenCaptureOperation = new SceneUtil::AsyncScreenCaptureOperation(mWorkQueue,
new SceneUtil::WriteScreenshotToFileOperation(mCfgMgr.getScreenshotPath(), new SceneUtil::WriteScreenshotToFileOperation(mCfgMgr.getScreenshotPath(),
Settings::general().mScreenshotFormat, Settings::general().mScreenshotFormat,
Settings::general().mNotifyOnSavedScreenshot Settings::general().mNotifyOnSavedScreenshot ? std::function<void(std::string)>(ScreenCaptureMessageBox{})
? std::function<void(std::string)>(ScheduleNonDialogMessageBox{})
: std::function<void(std::string)>(IgnoreString{}))); : std::function<void(std::string)>(IgnoreString{})));
mScreenCaptureHandler = new osgViewer::ScreenCaptureHandler(mScreenCaptureOperation); mScreenCaptureHandler = new osgViewer::ScreenCaptureHandler(mScreenCaptureOperation);

@ -122,10 +122,10 @@ namespace SceneUtil
<< mScreenshotFormat << "\": " << e.what(); << mScreenshotFormat << "\": " << e.what();
} }
if (fileName.empty()) if (fileName.empty())
mCallback("Failed to save screenshot"); mCallback(std::string());
else else
{ {
mCallback(Files::pathToUnicodeString(fileName) + " has been saved"); mCallback(Files::pathToUnicodeString(fileName));
Log(Debug::Info) << mScreenshotPath / fileName << " has been saved"; Log(Debug::Info) << mScreenshotPath / fileName << " has been saved";
} }
} }

@ -29,9 +29,11 @@ BuildingNavigationMesh: "Baue Navigationsgitter"
# This save file was created using an older version of OpenMW in a format that is no longer supported. # This save file was created using an older version of OpenMW in a format that is no longer supported.
# Load and save this file using {version} to upgrade it. # Load and save this file using {version} to upgrade it.
#NewGameConfirmation: "Do you want to start a new game and lose the current one?" #NewGameConfirmation: "Do you want to start a new game and lose the current one?"
#QuitGameConfirmation: "Quit the game?"
#SaveGameDenied: "The game cannot be saved right now." #SaveGameDenied: "The game cannot be saved right now."
#SavingInProgress: "Saving..." #SavingInProgress: "Saving..."
#QuitGameConfirmation: "Quit the game?" #ScreenshotFailed: "Failed to save screenshot"
#ScreenshotMade: "%s has been saved"
# Save game menu # Save game menu

@ -26,9 +26,11 @@ LoadingRequiresOldVersionError: |-
This save file was created using an older version of OpenMW in a format that is no longer supported. This save file was created using an older version of OpenMW in a format that is no longer supported.
Load and save this file using {version} to upgrade it. Load and save this file using {version} to upgrade it.
NewGameConfirmation: "Do you want to start a new game and lose the current one?" NewGameConfirmation: "Do you want to start a new game and lose the current one?"
QuitGameConfirmation: "Quit the game?"
SaveGameDenied: "The game cannot be saved right now." SaveGameDenied: "The game cannot be saved right now."
SavingInProgress: "Saving..." SavingInProgress: "Saving..."
QuitGameConfirmation: "Quit the game?" ScreenshotFailed: "Failed to save screenshot"
ScreenshotMade: "%s has been saved"
# Save game menu # Save game menu

@ -26,9 +26,11 @@ LoadingRequiresNewVersionError: |-
# This save file was created using an older version of OpenMW in a format that is no longer supported. # This save file was created using an older version of OpenMW in a format that is no longer supported.
# Load and save this file using {version} to upgrade it. # Load and save this file using {version} to upgrade it.
NewGameConfirmation: "Voulez-vous démarrer une nouvelle partie ? Toute progression non sauvegardée sera perdue." NewGameConfirmation: "Voulez-vous démarrer une nouvelle partie ? Toute progression non sauvegardée sera perdue."
QuitGameConfirmation: "Quitter la partie ?"
SaveGameDenied: "Sauvegarde impossible" SaveGameDenied: "Sauvegarde impossible"
SavingInProgress: "Sauvegarde en cours..." SavingInProgress: "Sauvegarde en cours..."
QuitGameConfirmation: "Quitter la partie ?" #ScreenshotFailed: "Failed to save screenshot"
#ScreenshotMade: "%s has been saved"
# Save game menu # Save game menu

@ -26,9 +26,11 @@ LoadingRequiresOldVersionError: |-
Это сохранение создано старой версией OpenMW и использует формат, который больше не поддерживается. Это сохранение создано старой версией OpenMW и использует формат, который больше не поддерживается.
Загрузите и сохраните этот файл в {version}, чтобы обновить его. Загрузите и сохраните этот файл в {version}, чтобы обновить его.
NewGameConfirmation: "Вы хотите начать новую игру? Текущая игра будет потеряна." NewGameConfirmation: "Вы хотите начать новую игру? Текущая игра будет потеряна."
QuitGameConfirmation: "Выйти из игры?"
SaveGameDenied: "В данный момент игру нельзя сохранить." SaveGameDenied: "В данный момент игру нельзя сохранить."
SavingInProgress: "Сохранение..." SavingInProgress: "Сохранение..."
QuitGameConfirmation: "Выйти из игры?" ScreenshotFailed: "Не удалось создать снимок экрана"
ScreenshotMade: "Создан снимок экрана %s"
# Save game menu # Save game menu

@ -26,9 +26,11 @@ LoadingRequiresNewVersionError: |-
# This save file was created using an older version of OpenMW in a format that is no longer supported. # This save file was created using an older version of OpenMW in a format that is no longer supported.
# Load and save this file using {version} to upgrade it. # Load and save this file using {version} to upgrade it.
NewGameConfirmation: "Vill du starta ett nytt spel och förlora det pågående spelet?" NewGameConfirmation: "Vill du starta ett nytt spel och förlora det pågående spelet?"
QuitGameConfirmation: "Avsluta spelet?"
SaveGameDenied: "Spelet kan inte sparas just nu." SaveGameDenied: "Spelet kan inte sparas just nu."
SavingInProgress: "Sparar..." SavingInProgress: "Sparar..."
QuitGameConfirmation: "Avsluta spelet?" #ScreenshotFailed: "Failed to save screenshot"
#ScreenshotMade: "%s has been saved"
# Save game menu # Save game menu

Loading…
Cancel
Save