summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorSilarn <jrim@rimpo.org>2019-12-14 18:11:57 -0600
committerSilarn <jrim@rimpo.org>2019-12-14 18:11:57 -0600
commit51e3e078be10a085702014b4b873d69c502e8b0a (patch)
tree0cb906764d1f5ece8963c238aa99de9f7b6552af /src/shared
parentfde5fa279746c90180223942a44f865859f85cb3 (diff)
Fix problem with translated unmanaged mods and origin names
- (Also adds translatable strings to directoryentry.cpp)
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/directoryentry.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp
index 2cdbac74..00bf319e 100644
--- a/src/shared/directoryentry.cpp
+++ b/src/shared/directoryentry.cpp
@@ -32,6 +32,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <algorithm>
#include <map>
#include <atomic>
+#include <QObject>
namespace MOShared {
@@ -83,7 +84,7 @@ public:
return m_Origins[iter->second];
} else {
std::ostringstream stream;
- stream << "invalid origin name: " << ToString(name, false);
+ stream << QObject::tr("invalid origin name: ").toStdString() << ToString(name, true);
throw std::runtime_error(stream.str());
}
}
@@ -106,7 +107,7 @@ public:
m_OriginsNameMap.erase(iter);
m_OriginsNameMap[newName] = idx;
} else {
- log::error("failed to change name lookup from {} to {}", oldName, newName);
+ log::error(QObject::tr("failed to change name lookup from {} to {}").toStdString(), oldName, newName);
}
}
@@ -520,7 +521,7 @@ void DirectoryEntry::addFromBSA(const std::wstring &originName, std::wstring &di
WIN32_FILE_ATTRIBUTE_DATA fileData;
if (::GetFileAttributesExW(fileName.c_str(), GetFileExInfoStandard, &fileData) == 0) {
- throw windows_error("failed to determine file time");
+ throw windows_error(QObject::tr("failed to determine file time").toStdString());
}
FILETIME now;
::GetSystemTimeAsFileTime(&now);
@@ -542,7 +543,7 @@ void DirectoryEntry::addFromBSA(const std::wstring &originName, std::wstring &di
BSA::EErrorCode res = archive.read(ToString(fileName, false).c_str(), false);
if ((res != BSA::ERROR_NONE) && (res != BSA::ERROR_INVALIDHASHES)) {
std::ostringstream stream;
- stream << "invalid bsa file: " << ToString(fileName, false) << " errorcode " << res << " - " << ::GetLastError();
+ stream << QObject::tr("invalid bsa file: ").toStdString() << ToString(fileName, false) << " errorcode " << res << " - " << ::GetLastError();
throw std::runtime_error(stream.str());
}
@@ -718,12 +719,12 @@ void DirectoryEntry::removeFile(FileEntry::Index index)
m_Files.erase(iter);
} else {
log::error(
- "file \"{}\" not in directory \"{}\"",
+ QObject::tr("file \"{}\" not in directory \"{}\"").toStdString(),
m_FileRegister->getFile(index)->getName(), this->getName());
}
} else {
log::error(
- "file \"{}\" not in directory \"{}\", directory empty",
+ QObject::tr("file \"{}\" not in directory \"{}\", directory empty").toStdString(),
m_FileRegister->getFile(index)->getName(), this->getName());
}
}
@@ -847,7 +848,7 @@ const FileEntry::Ptr DirectoryEntry::searchFile(const std::wstring &path, const
DirectoryEntry *temp = findSubDirectory(pathComponent);
if (temp != nullptr) {
if (len >= path.size()) {
- log::error("unexpected end of path");
+ log::error(QObject::tr("unexpected end of path").toStdString());
return FileEntry::Ptr();
}
return temp->searchFile(path.substr(len + 1), directory);
@@ -991,7 +992,7 @@ bool FileRegister::removeFile(FileEntry::Index index)
m_Files.erase(index);
return true;
} else {
- log::error("invalid file index for remove: {}", index);
+ log::error(QObject::tr("invalid file index for remove: {}").toStdString(), index);
return false;
}
}
@@ -1005,7 +1006,7 @@ void FileRegister::removeOrigin(FileEntry::Index index, int originID)
m_Files.erase(iter);
}
} else {
- log::error("invalid file index for remove (for origin): {}", index);
+ log::error(QObject::tr("invalid file index for remove (for origin): {}").toStdString(), index);
}
}