mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 17:45:38 +00:00
Added localization support to parts of the application
This commit is contained in:
parent
085b3da8e0
commit
35f51e6904
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "components/VideoFFmpegComponent.h"
|
#include "components/VideoFFmpegComponent.h"
|
||||||
|
#include "utils/LocalizationUtil.h"
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
#define KEY_REPEAT_START_DELAY 600
|
#define KEY_REPEAT_START_DELAY 600
|
||||||
|
@ -79,7 +80,7 @@ bool MediaViewer::startMediaViewer(FileData* game)
|
||||||
mEntryCount = std::to_string(mImages.size() + (mVideo == nullptr ? 0 : 1));
|
mEntryCount = std::to_string(mImages.size() + (mVideo == nullptr ? 0 : 1));
|
||||||
|
|
||||||
mMediaType =
|
mMediaType =
|
||||||
std::make_unique<TextComponent>((mHasVideo ? "VIDEO" : mImageFiles[0].second.mediaType),
|
std::make_unique<TextComponent>((mHasVideo ? _("VIDEO") : mImageFiles[0].second.mediaType),
|
||||||
Font::get(FONT_SIZE_MINI, FONT_PATH_REGULAR), 0xAAAAAAFF);
|
Font::get(FONT_SIZE_MINI, FONT_PATH_REGULAR), 0xAAAAAAFF);
|
||||||
mMediaType->setOrigin(0.0f, 0.5f);
|
mMediaType->setOrigin(0.0f, 0.5f);
|
||||||
|
|
||||||
|
@ -246,11 +247,11 @@ void MediaViewer::render(const glm::mat4& /*parentTrans*/)
|
||||||
std::vector<HelpPrompt> MediaViewer::getHelpPrompts()
|
std::vector<HelpPrompt> MediaViewer::getHelpPrompts()
|
||||||
{
|
{
|
||||||
std::vector<HelpPrompt> prompts;
|
std::vector<HelpPrompt> prompts;
|
||||||
prompts.push_back(HelpPrompt("left/right", "browse"));
|
prompts.push_back(HelpPrompt("left/right", _("browse")));
|
||||||
if (mHasManual)
|
if (mHasManual)
|
||||||
prompts.push_back(HelpPrompt("up", "pdf manual"));
|
prompts.push_back(HelpPrompt("up", _("pdf manual")));
|
||||||
prompts.push_back(HelpPrompt("lt", "first"));
|
prompts.push_back(HelpPrompt("lt", _("first")));
|
||||||
prompts.push_back(HelpPrompt("rt", "last"));
|
prompts.push_back(HelpPrompt("rt", _("last")));
|
||||||
|
|
||||||
return prompts;
|
return prompts;
|
||||||
}
|
}
|
||||||
|
@ -280,34 +281,34 @@ void MediaViewer::findMedia()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mHasVideo && (mediaFile = mGame->getScreenshotPath()) != "") {
|
if (!mHasVideo && (mediaFile = mGame->getScreenshotPath()) != "") {
|
||||||
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo("SCREENSHOT", false)));
|
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo(_("SCREENSHOT"), false)));
|
||||||
mScreenshotIndex = 0;
|
mScreenshotIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mediaFile = mGame->getCoverPath()) != "")
|
if ((mediaFile = mGame->getCoverPath()) != "")
|
||||||
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo("BOX COVER", true)));
|
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo(_("BOX COVER"), true)));
|
||||||
|
|
||||||
if ((mediaFile = mGame->getBackCoverPath()) != "")
|
if ((mediaFile = mGame->getBackCoverPath()) != "")
|
||||||
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo("BOX BACK COVER", true)));
|
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo(_("BOX BACK COVER"), true)));
|
||||||
|
|
||||||
if ((mediaFile = mGame->getTitleScreenPath()) != "") {
|
if ((mediaFile = mGame->getTitleScreenPath()) != "") {
|
||||||
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo("TITLE SCREEN", false)));
|
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo(_("TITLE SCREEN"), false)));
|
||||||
mTitleScreenIndex = static_cast<int>(mImageFiles.size() - 1);
|
mTitleScreenIndex = static_cast<int>(mImageFiles.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mHasVideo && (mediaFile = mGame->getScreenshotPath()) != "") {
|
if (mHasVideo && (mediaFile = mGame->getScreenshotPath()) != "") {
|
||||||
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo("SCREENSHOT", false)));
|
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo(_("SCREENSHOT"), false)));
|
||||||
mScreenshotIndex = static_cast<int>(mImageFiles.size() - 1);
|
mScreenshotIndex = static_cast<int>(mImageFiles.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mediaFile = mGame->getFanArtPath()) != "")
|
if ((mediaFile = mGame->getFanArtPath()) != "")
|
||||||
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo("FAN ART", true)));
|
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo(_("FAN ART"), true)));
|
||||||
|
|
||||||
if ((mediaFile = mGame->getMiximagePath()) != "")
|
if ((mediaFile = mGame->getMiximagePath()) != "")
|
||||||
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo("MIXIMAGE", true)));
|
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo(_("MIXIMAGE"), true)));
|
||||||
|
|
||||||
if ((mediaFile = mGame->getCustomImagePath()) != "")
|
if ((mediaFile = mGame->getCustomImagePath()) != "")
|
||||||
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo("CUSTOM", true)));
|
mImageFiles.push_back(std::make_pair(mediaFile, ImageInfo(_("CUSTOM"), true)));
|
||||||
|
|
||||||
if (!mImageFiles.empty())
|
if (!mImageFiles.empty())
|
||||||
mHasImages = true;
|
mHasImages = true;
|
||||||
|
@ -406,7 +407,7 @@ void MediaViewer::showPrevious()
|
||||||
}
|
}
|
||||||
else if (mCurrentImageIndex == 0 && mHasVideo) {
|
else if (mCurrentImageIndex == 0 && mHasVideo) {
|
||||||
mDisplayingImage = false;
|
mDisplayingImage = false;
|
||||||
mMediaType->setText("VIDEO");
|
mMediaType->setText(_("VIDEO"));
|
||||||
playVideo();
|
playVideo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -425,7 +426,8 @@ void MediaViewer::showFirst()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mCurrentImageIndex = 0;
|
mCurrentImageIndex = 0;
|
||||||
mMediaType->setText((mHasVideo ? "VIDEO" : mImageFiles[mCurrentImageIndex].second.mediaType));
|
mMediaType->setText(
|
||||||
|
(mHasVideo ? _("VIDEO") : mImageFiles[mCurrentImageIndex].second.mediaType));
|
||||||
|
|
||||||
if (mHasVideo) {
|
if (mHasVideo) {
|
||||||
mDisplayingImage = false;
|
mDisplayingImage = false;
|
||||||
|
|
|
@ -46,7 +46,7 @@ void MiximageGenerator::startThread(std::promise<bool>* miximagePromise)
|
||||||
if ((mScreenshotPath = mGame->getScreenshotPath()) == "") {
|
if ((mScreenshotPath = mGame->getScreenshotPath()) == "") {
|
||||||
LOG(LogDebug) << "MiximageGenerator::MiximageGenerator(): "
|
LOG(LogDebug) << "MiximageGenerator::MiximageGenerator(): "
|
||||||
"No screenshot image found, aborting";
|
"No screenshot image found, aborting";
|
||||||
mResultMessage = _("No screenshot image found, couldn't generate miximage");
|
mResultMessage = _("No screenshot found, couldn't generate miximage");
|
||||||
mMiximagePromise->set_value(true);
|
mMiximagePromise->set_value(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ bool MiximageGenerator::generateImage()
|
||||||
|
|
||||||
if (fileFormat == FIF_UNKNOWN) {
|
if (fileFormat == FIF_UNKNOWN) {
|
||||||
LOG(LogError) << "Screenshot image in unknown image format, aborting";
|
LOG(LogError) << "Screenshot image in unknown image format, aborting";
|
||||||
mMessage = "Screenshot image in unknown format, couldn't generate miximage";
|
mMessage = _("Screenshot in unknown format, couldn't generate miximage");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,13 +152,13 @@ bool MiximageGenerator::generateImage()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG(LogError) << "Screenshot file format not supported";
|
LOG(LogError) << "Screenshot file format not supported";
|
||||||
mMessage = "Screenshot image in unsupported format, couldn't generate miximage";
|
mMessage = _("Screenshot in unsupported format, couldn't generate miximage");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!screenshotFile) {
|
if (!screenshotFile) {
|
||||||
LOG(LogError) << "Error loading screenshot image, corrupt file?";
|
LOG(LogError) << "Error loading screenshot image, corrupt file?";
|
||||||
mMessage = "Error loading screenshot image, couldn't generate miximage";
|
mMessage = _("Error loading screenshot, couldn't generate miximage");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ bool MiximageGenerator::generateImage()
|
||||||
#endif
|
#endif
|
||||||
if (!marqueeFile) {
|
if (!marqueeFile) {
|
||||||
LOG(LogError) << "Couldn't load marquee image, corrupt file?";
|
LOG(LogError) << "Couldn't load marquee image, corrupt file?";
|
||||||
mMessage = "Error loading marquee image, corrupt file?";
|
mMessage = _("Error loading marquee image, corrupt file?");
|
||||||
mMarquee = false;
|
mMarquee = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ bool MiximageGenerator::generateImage()
|
||||||
#endif
|
#endif
|
||||||
if (!boxFile) {
|
if (!boxFile) {
|
||||||
LOG(LogError) << "Couldn't load 3D box image, corrupt file?";
|
LOG(LogError) << "Couldn't load 3D box image, corrupt file?";
|
||||||
mMessage = "Error loading 3d box image, corrupt file?";
|
mMessage = _("Error loading 3d box image, corrupt file?");
|
||||||
mBox3D = false;
|
mBox3D = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ bool MiximageGenerator::generateImage()
|
||||||
#endif
|
#endif
|
||||||
if (!boxFile) {
|
if (!boxFile) {
|
||||||
LOG(LogError) << "Couldn't load box cover image, corrupt file?";
|
LOG(LogError) << "Couldn't load box cover image, corrupt file?";
|
||||||
mMessage = "Error loading box cover image, corrupt file?";
|
mMessage = _("Error loading box cover image, corrupt file?");
|
||||||
mCover = false;
|
mCover = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ bool MiximageGenerator::generateImage()
|
||||||
#endif
|
#endif
|
||||||
if (!physicalMediaFile) {
|
if (!physicalMediaFile) {
|
||||||
LOG(LogError) << "Couldn't load physical media image, corrupt file?";
|
LOG(LogError) << "Couldn't load physical media image, corrupt file?";
|
||||||
mMessage = "Error loading physical media image, corrupt file?";
|
mMessage = _("Error loading physical media image, corrupt file?");
|
||||||
mPhysicalMedia = false;
|
mPhysicalMedia = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "utils/FileSystemUtil.h"
|
#include "utils/FileSystemUtil.h"
|
||||||
|
#include "utils/LocalizationUtil.h"
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
|
@ -185,7 +186,8 @@ bool PDFViewer::startPDFViewer(FileData* game)
|
||||||
mEntryCount = std::to_string(mPages.size());
|
mEntryCount = std::to_string(mPages.size());
|
||||||
|
|
||||||
mEntryNumText = std::make_unique<TextComponent>(
|
mEntryNumText = std::make_unique<TextComponent>(
|
||||||
"PAGE 1 OF " + mEntryCount, Font::get(FONT_SIZE_MINI, FONT_PATH_REGULAR), 0xAAAAAAFF);
|
Utils::String::format(_("PAGE %s OF %s"), "1", mEntryCount.c_str()),
|
||||||
|
Font::get(FONT_SIZE_MINI, FONT_PATH_REGULAR), 0xAAAAAAFF);
|
||||||
mEntryNumText->setOrigin(0.0f, 0.5f);
|
mEntryNumText->setOrigin(0.0f, 0.5f);
|
||||||
|
|
||||||
if (mHelpInfoPosition == HelpInfoPosition::TOP) {
|
if (mHelpInfoPosition == HelpInfoPosition::TOP) {
|
||||||
|
@ -706,17 +708,17 @@ std::vector<HelpPrompt> PDFViewer::getHelpPrompts()
|
||||||
{
|
{
|
||||||
std::vector<HelpPrompt> prompts;
|
std::vector<HelpPrompt> prompts;
|
||||||
if (mZoom > 1.0f) {
|
if (mZoom > 1.0f) {
|
||||||
prompts.push_back(HelpPrompt("up/down/left/right", "pan"));
|
prompts.push_back(HelpPrompt("up/down/left/right", _("pan")));
|
||||||
prompts.push_back(HelpPrompt("ltrt", "reset"));
|
prompts.push_back(HelpPrompt("ltrt", _("reset")));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
prompts.push_back(HelpPrompt("left/right", "browse"));
|
prompts.push_back(HelpPrompt("left/right", _("browse")));
|
||||||
prompts.push_back(HelpPrompt("down", "game media"));
|
prompts.push_back(HelpPrompt("down", _("game media")));
|
||||||
prompts.push_back(HelpPrompt("lt", "first"));
|
prompts.push_back(HelpPrompt("lt", _("first")));
|
||||||
prompts.push_back(HelpPrompt("rt", "last"));
|
prompts.push_back(HelpPrompt("rt", _("last")));
|
||||||
}
|
}
|
||||||
|
|
||||||
prompts.push_back(HelpPrompt("lr", "zoom"));
|
prompts.push_back(HelpPrompt("lr", _("zoom")));
|
||||||
|
|
||||||
return prompts;
|
return prompts;
|
||||||
}
|
}
|
||||||
|
@ -728,7 +730,8 @@ void PDFViewer::showNextPage()
|
||||||
|
|
||||||
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
||||||
++mCurrentPage;
|
++mCurrentPage;
|
||||||
mEntryNumText->setText("PAGE " + std::to_string(mCurrentPage) + " OF " + mEntryCount);
|
mEntryNumText->setText(Utils::String::format(
|
||||||
|
_("PAGE %s OF %s"), std::to_string(mCurrentPage).c_str(), mEntryCount.c_str()));
|
||||||
convertPage(mCurrentPage);
|
convertPage(mCurrentPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,7 +742,8 @@ void PDFViewer::showPreviousPage()
|
||||||
|
|
||||||
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
||||||
--mCurrentPage;
|
--mCurrentPage;
|
||||||
mEntryNumText->setText("PAGE " + std::to_string(mCurrentPage) + " OF " + mEntryCount);
|
mEntryNumText->setText(Utils::String::format(
|
||||||
|
_("PAGE %s OF %s"), std::to_string(mCurrentPage).c_str(), mEntryCount.c_str()));
|
||||||
convertPage(mCurrentPage);
|
convertPage(mCurrentPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,7 +832,8 @@ void PDFViewer::navigateLeftTrigger()
|
||||||
|
|
||||||
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
||||||
mCurrentPage = 1;
|
mCurrentPage = 1;
|
||||||
mEntryNumText->setText("PAGE " + std::to_string(mCurrentPage) + " OF " + mEntryCount);
|
mEntryNumText->setText(Utils::String::format(
|
||||||
|
_("PAGE %s OF %s"), std::to_string(mCurrentPage).c_str(), mEntryCount.c_str()));
|
||||||
convertPage(mCurrentPage);
|
convertPage(mCurrentPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,6 +854,7 @@ void PDFViewer::navigateRightTrigger()
|
||||||
|
|
||||||
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
|
||||||
mCurrentPage = mPageCount;
|
mCurrentPage = mPageCount;
|
||||||
mEntryNumText->setText("PAGE " + std::to_string(mCurrentPage) + " OF " + mEntryCount);
|
mEntryNumText->setText(Utils::String::format(
|
||||||
|
_("PAGE %s OF %s"), std::to_string(mCurrentPage).c_str(), mEntryCount.c_str()));
|
||||||
convertPage(mCurrentPage);
|
convertPage(mCurrentPage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "SystemData.h"
|
#include "SystemData.h"
|
||||||
#include "components/ComponentGrid.h"
|
#include "components/ComponentGrid.h"
|
||||||
#include "components/TextComponent.h"
|
#include "components/TextComponent.h"
|
||||||
|
#include "utils/LocalizationUtil.h"
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
GuiLaunchScreen::GuiLaunchScreen()
|
GuiLaunchScreen::GuiLaunchScreen()
|
||||||
|
@ -54,7 +55,7 @@ void GuiLaunchScreen::displayLaunchScreen(FileData* game)
|
||||||
|
|
||||||
// Title.
|
// Title.
|
||||||
mTitle = std::make_shared<TextComponent>(
|
mTitle = std::make_shared<TextComponent>(
|
||||||
"LAUNCHING GAME",
|
_("LAUNCHING GAME"),
|
||||||
Font::get(titleFontSize *
|
Font::get(titleFontSize *
|
||||||
std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth())),
|
std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth())),
|
||||||
mMenuColorTertiary, ALIGN_CENTER);
|
mMenuColorTertiary, ALIGN_CENTER);
|
||||||
|
|
|
@ -952,7 +952,7 @@ void GuiScraperSearch::updateThumbnail()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mResultThumbnail->setImage("");
|
mResultThumbnail->setImage("");
|
||||||
onSearchError("Error downloading thumbnail:\n " + it->second->getErrorMsg(), true,
|
onSearchError(_("Error downloading thumbnail:") + " \n" + it->second->getErrorMsg(), true,
|
||||||
(mSearchHandle != nullptr ? mSearchHandle->getFatalError() : false),
|
(mSearchHandle != nullptr ? mSearchHandle->getFatalError() : false),
|
||||||
it->second->status());
|
it->second->status());
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "ScreenScraper.h"
|
#include "ScreenScraper.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "SystemData.h"
|
#include "SystemData.h"
|
||||||
|
#include "utils/LocalizationUtil.h"
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
|
@ -178,7 +179,7 @@ void ScraperHttpRequest::update()
|
||||||
// Everything else is some sort of error.
|
// Everything else is some sort of error.
|
||||||
LOG(LogError) << "ScraperHttpRequest network error (status: " << status << ") - "
|
LOG(LogError) << "ScraperHttpRequest network error (status: " << status << ") - "
|
||||||
<< mReq->getErrorMsg();
|
<< mReq->getErrorMsg();
|
||||||
setError("Network error: " + mReq->getErrorMsg(), true);
|
setError(_("Network error:") + " " + mReq->getErrorMsg(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download and write the media files to disk.
|
// Download and write the media files to disk.
|
||||||
|
@ -325,8 +326,8 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
|
||||||
// If the media directory does not exist, something is wrong, possibly permission
|
// If the media directory does not exist, something is wrong, possibly permission
|
||||||
// problems or the MediaDirectory setting points to a file instead of a directory.
|
// problems or the MediaDirectory setting points to a file instead of a directory.
|
||||||
if (!Utils::FileSystem::isDirectory(Utils::FileSystem::getParent(filePath))) {
|
if (!Utils::FileSystem::isDirectory(Utils::FileSystem::getParent(filePath))) {
|
||||||
setError("Media directory does not exist and can't be created. "
|
setError(_("Media directory does not exist and can't be created.") + " \n" +
|
||||||
"Permission problems?",
|
_("Permission problems?"),
|
||||||
false);
|
false);
|
||||||
LOG(LogError) << "Couldn't create media directory: \""
|
LOG(LogError) << "Couldn't create media directory: \""
|
||||||
<< Utils::FileSystem::getParent(filePath) << "\"";
|
<< Utils::FileSystem::getParent(filePath) << "\"";
|
||||||
|
@ -340,7 +341,9 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
|
||||||
std::ofstream stream(filePath, std::ios_base::out | std::ios_base::binary);
|
std::ofstream stream(filePath, std::ios_base::out | std::ios_base::binary);
|
||||||
#endif
|
#endif
|
||||||
if (!stream || stream.bad()) {
|
if (!stream || stream.bad()) {
|
||||||
setError("Failed to open path for writing media file\nPermission error?", false);
|
setError(_("Failed to open path for writing media file.") + " \n" +
|
||||||
|
_("Permission problems?"),
|
||||||
|
false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,14 +351,17 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
|
||||||
stream.write(content.data(), content.length());
|
stream.write(content.data(), content.length());
|
||||||
stream.close();
|
stream.close();
|
||||||
if (stream.bad()) {
|
if (stream.bad()) {
|
||||||
setError("Failed to save media file\nDisk full?", false);
|
setError(_("Couldn't save media file, permission problems or is the disk full?"),
|
||||||
|
false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize it.
|
// Resize it.
|
||||||
if (it->resizeFile) {
|
if (it->resizeFile) {
|
||||||
if (!resizeImage(filePath, it->subDirectory)) {
|
if (!resizeImage(filePath, it->subDirectory)) {
|
||||||
setError("Error saving resized image\nOut of memory? Disk full?", false);
|
setError(
|
||||||
|
_("Couldn't save resized image, permission problems or is the disk full?"),
|
||||||
|
false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,7 +435,7 @@ void MediaDownloadHandle::update()
|
||||||
|
|
||||||
if (mReq->status() != HttpReq::REQ_SUCCESS) {
|
if (mReq->status() != HttpReq::REQ_SUCCESS) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "Network error: " << mReq->getErrorMsg();
|
ss << _("Network error:") << " " << mReq->getErrorMsg();
|
||||||
setError(ss.str(), true);
|
setError(ss.str(), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -524,7 +530,8 @@ void MediaDownloadHandle::update()
|
||||||
// If the media directory does not exist, something is wrong, possibly permission
|
// If the media directory does not exist, something is wrong, possibly permission
|
||||||
// problems or the MediaDirectory setting points to a file instead of a directory.
|
// problems or the MediaDirectory setting points to a file instead of a directory.
|
||||||
if (!Utils::FileSystem::isDirectory(Utils::FileSystem::getParent(mSavePath))) {
|
if (!Utils::FileSystem::isDirectory(Utils::FileSystem::getParent(mSavePath))) {
|
||||||
setError("Media directory does not exist and can't be created. Permission problems?",
|
setError(_("Media directory does not exist and can't be created.") + " \n" +
|
||||||
|
_("Permission problems?"),
|
||||||
false);
|
false);
|
||||||
LOG(LogError) << "Couldn't create media directory: \""
|
LOG(LogError) << "Couldn't create media directory: \""
|
||||||
<< Utils::FileSystem::getParent(mSavePath) << "\"";
|
<< Utils::FileSystem::getParent(mSavePath) << "\"";
|
||||||
|
@ -538,7 +545,9 @@ void MediaDownloadHandle::update()
|
||||||
std::ofstream stream(mSavePath, std::ios_base::out | std::ios_base::binary);
|
std::ofstream stream(mSavePath, std::ios_base::out | std::ios_base::binary);
|
||||||
#endif
|
#endif
|
||||||
if (!stream || stream.bad()) {
|
if (!stream || stream.bad()) {
|
||||||
setError("Failed to open path for writing media file\nPermission error?", false);
|
setError(_("Failed to open path for writing media file.") + " \n" +
|
||||||
|
_("Permission problems?"),
|
||||||
|
false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,7 +555,7 @@ void MediaDownloadHandle::update()
|
||||||
stream.write(content.data(), content.length());
|
stream.write(content.data(), content.length());
|
||||||
stream.close();
|
stream.close();
|
||||||
if (stream.bad()) {
|
if (stream.bad()) {
|
||||||
setError("Failed to save media file\nDisk full?", false);
|
setError(_("Couldn't save media file, permission problems or is the disk full?"), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,7 +579,8 @@ void MediaDownloadHandle::update()
|
||||||
// Resize it.
|
// Resize it.
|
||||||
if (mResizeFile) {
|
if (mResizeFile) {
|
||||||
if (!resizeImage(mSavePath, mMediaType)) {
|
if (!resizeImage(mSavePath, mMediaType)) {
|
||||||
setError("Error saving resized image\nOut of memory? Disk full?", false);
|
setError(_("Couldn't save resized image, permission problems or is the disk full?"),
|
||||||
|
false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "PlatformId.h"
|
#include "PlatformId.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "SystemData.h"
|
#include "SystemData.h"
|
||||||
|
#include "utils/LocalizationUtil.h"
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
#include "utils/TimeUtil.h"
|
#include "utils/TimeUtil.h"
|
||||||
|
|
||||||
|
@ -291,7 +292,7 @@ void ScreenScraperRequest::process(const std::unique_ptr<HttpReq>& req,
|
||||||
std::string content {req->getContent()};
|
std::string content {req->getContent()};
|
||||||
if (content.length() > maxErrorLength)
|
if (content.length() > maxErrorLength)
|
||||||
content = content.substr(0, maxErrorLength) + "...";
|
content = content.substr(0, maxErrorLength) + "...";
|
||||||
setError("ScreenScraper error: \n" + content, true);
|
setError(_("ScreenScraper error:") + " \n" + content, true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +358,7 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,
|
||||||
<< Settings::getInstance()->getString("ScraperUsernameScreenScraper")
|
<< Settings::getInstance()->getString("ScraperUsernameScreenScraper")
|
||||||
<< "\", wrong username or password?";
|
<< "\", wrong username or password?";
|
||||||
|
|
||||||
setError("ScreenScraper: Wrong username or password", false, true);
|
setError(_("ScreenScraper: Wrong username or password"), false, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "resources/ResourceManager.h"
|
#include "resources/ResourceManager.h"
|
||||||
#include "utils/FileSystemUtil.h"
|
#include "utils/FileSystemUtil.h"
|
||||||
|
#include "utils/LocalizationUtil.h"
|
||||||
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -398,7 +400,7 @@ void HttpReq::pollCurl()
|
||||||
|
|
||||||
if (responseCode == 430 &&
|
if (responseCode == 430 &&
|
||||||
Settings::getInstance()->getString("Scraper") == "screenscraper") {
|
Settings::getInstance()->getString("Scraper") == "screenscraper") {
|
||||||
req->mContent << "You have exceeded your daily scrape quota";
|
req->mContent << _("You have exceeded your daily scrape quota");
|
||||||
req->mStatus = REQ_SUCCESS;
|
req->mStatus = REQ_SUCCESS;
|
||||||
}
|
}
|
||||||
else if (responseCode == 404 && req->mScraperRequest &&
|
else if (responseCode == 404 && req->mScraperRequest &&
|
||||||
|
@ -407,8 +409,9 @@ void HttpReq::pollCurl()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
req->mStatus = REQ_BAD_STATUS_CODE;
|
req->mStatus = REQ_BAD_STATUS_CODE;
|
||||||
req->onError("Server returned HTTP error code " +
|
req->onError(
|
||||||
std::to_string(responseCode));
|
Utils::String::format(_("Server returned HTTP error code %s"),
|
||||||
|
std::to_string(responseCode).c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "GuiComponent.h"
|
#include "GuiComponent.h"
|
||||||
#include "components/ComponentGrid.h"
|
#include "components/ComponentGrid.h"
|
||||||
#include "components/NinePatchComponent.h"
|
#include "components/NinePatchComponent.h"
|
||||||
|
#include "utils/LocalizationUtil.h"
|
||||||
|
|
||||||
class ButtonComponent;
|
class ButtonComponent;
|
||||||
class TextComponent;
|
class TextComponent;
|
||||||
|
@ -22,7 +23,7 @@ class GuiMsgBox : public GuiComponent
|
||||||
public:
|
public:
|
||||||
GuiMsgBox(const HelpStyle& helpstyle,
|
GuiMsgBox(const HelpStyle& helpstyle,
|
||||||
const std::string& text,
|
const std::string& text,
|
||||||
const std::string& name1 = "OK",
|
const std::string& name1 = _("OK"),
|
||||||
const std::function<void()>& func1 = nullptr,
|
const std::function<void()>& func1 = nullptr,
|
||||||
const std::string& name2 = "",
|
const std::string& name2 = "",
|
||||||
const std::function<void()>& func2 = nullptr,
|
const std::function<void()>& func2 = nullptr,
|
||||||
|
|
Loading…
Reference in a new issue