Replace concatenation of translatable strings

This commit is contained in:
Oliver Hamlet
2016-11-24 17:58:39 +00:00
parent 55289d7b09
commit 97640895a9
5 changed files with 46 additions and 48 deletions
+28 -32
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: LOOT 0.10.0\n"
"Report-Msgid-Bugs-To: https://github.com/loot/loot/issues\n"
"POT-Creation-Date: 2016-11-20 10:46+0000\n"
"POT-Creation-Date: 2016-11-22 18:27+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -666,52 +666,52 @@ msgid "Game path could not be detected."
msgstr ""
#: src/backend/game/game.cpp:74
msgid "Could not create LOOT folder for game. Details:"
msgid "Could not create LOOT folder for game. Details: %1%"
msgstr ""
#: src/backend/game/game_cache.cpp:119
msgid "You have not sorted your load order this session."
msgstr ""
#: src/backend/game/load_order_handler.cpp:46
#: src/backend/game/load_order_handler.cpp:48
msgid "Game path is not initialised."
msgstr ""
#: src/backend/game/load_order_handler.cpp:82
#: src/backend/game/load_order_handler.cpp:84
msgid ""
"libloadorder failed to create a game handle. Details could not be fetched."
msgstr ""
#: src/backend/game/load_order_handler.cpp:85
msgid "libloadorder failed to create a game handle. Details:"
#: src/backend/game/load_order_handler.cpp:87
msgid "libloadorder failed to create a game handle. Details: %1%"
msgstr ""
#: src/backend/game/load_order_handler.cpp:103
#: src/backend/game/load_order_handler.cpp:105
msgid ""
"libloadorder failed to check if a plugin is active. Details could not be "
"fetched."
msgstr ""
#: src/backend/game/load_order_handler.cpp:106
msgid "libloadorder failed to check if a plugin is active. Details:"
#: src/backend/game/load_order_handler.cpp:108
msgid "libloadorder failed to check if a plugin is active. Details: %1%"
msgstr ""
#: src/backend/game/load_order_handler.cpp:128
#: src/backend/game/load_order_handler.cpp:130
msgid ""
"libloadorder failed to get the load order. Details could not be fetched."
msgstr ""
#: src/backend/game/load_order_handler.cpp:131
msgid "libloadorder failed to get the load order. Details:"
#: src/backend/game/load_order_handler.cpp:133
msgid "libloadorder failed to get the load order. Details: %1%"
msgstr ""
#: src/backend/game/load_order_handler.cpp:168
#: src/backend/game/load_order_handler.cpp:170
msgid ""
"libloadorder failed to set the load order. Details could not be fetched."
msgstr ""
#: src/backend/game/load_order_handler.cpp:171
msgid "libloadorder failed to set the load order. Details:"
#: src/backend/game/load_order_handler.cpp:173
msgid "libloadorder failed to set the load order. Details: %1%"
msgstr ""
#: src/backend/helpers/git_helper.cpp:105
@@ -737,12 +737,12 @@ msgstr ""
msgid "Failed to open file in its default application."
msgstr ""
#: src/backend/metadata/condition_evaluator.cpp:170
msgid "Invalid file path:"
#: src/backend/metadata/condition_evaluator.cpp:173
msgid "Invalid file path: %1%"
msgstr ""
#: src/backend/metadata/condition_evaluator.cpp:180
#: src/backend/metadata/condition_evaluator.cpp:220
#: src/backend/metadata/condition_evaluator.cpp:183
#: src/backend/metadata/condition_evaluator.cpp:223
msgid "Invalid regex string \"%1%\": %2%"
msgstr ""
@@ -810,40 +810,36 @@ msgid ""
"%3%"
msgstr ""
#: src/backend/masterlist.cpp:44
#: src/backend/masterlist.cpp:45
msgid ""
"An error occurred while trying to read the local masterlist's version. If "
"this error happens again, try deleting the \".git\" folder in %1%."
msgstr ""
#: src/backend/masterlist.cpp:48
#: src/backend/masterlist.cpp:49
msgid "N/A: No masterlist present"
msgstr ""
#: src/backend/masterlist.cpp:51
#: src/backend/masterlist.cpp:52
msgid "Unknown: Git repository missing"
msgstr ""
#: src/backend/masterlist.cpp:116 src/backend/masterlist.cpp:130
#: src/backend/masterlist.cpp:117 src/backend/masterlist.cpp:131
msgid ""
"An error occurred while trying to access the local masterlist repository. If "
"this error happens again, try deleting the \".git\" folder in %1%."
msgstr ""
#: src/backend/masterlist.cpp:237
#: src/backend/masterlist.cpp:238
msgid ""
"An error occurred while trying to read information on the updated "
"masterlist. If this error happens again, try deleting the \".git\" folder in "
"%1%."
msgstr ""
#: src/backend/masterlist.cpp:251
msgid "Masterlist revision"
msgstr ""
#: src/backend/masterlist.cpp:255
#: src/backend/masterlist.cpp:252
msgid ""
"The latest masterlist revision contains a syntax error, LOOT is using the "
"most recent valid revision instead. Syntax errors are usually minor and "
"fixed within hours."
"Masterlist revision %1%: %2%. The latest masterlist revision contains a "
"syntax error, LOOT is using the most recent valid revision instead. Syntax "
"errors are usually minor and fixed within hours."
msgstr ""
+1 -1
View File
@@ -71,7 +71,7 @@ void Game::Init(bool createFolder, const boost::filesystem::path& gameLocalAppDa
fs::create_directories(LootPaths::getLootDataPath() / FolderName());
} catch (fs::filesystem_error& e) {
BOOST_LOG_TRIVIAL(error) << "Could not create LOOT folder for game. Details: " << e.what();
throw FileAccessError(translate("Could not create LOOT folder for game. Details:").str() + " " + e.what());
throw FileAccessError((boost::format(translate("Could not create LOOT folder for game. Details: %1%")) % e.what()).str());
}
}
+6 -4
View File
@@ -25,11 +25,13 @@
#include "backend/game/load_order_handler.h"
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/locale.hpp>
#include <boost/log/trivial.hpp>
#include "loot/exception/error_categories.h"
using boost::format;
using boost::locale::translate;
using std::string;
@@ -82,7 +84,7 @@ void LoadOrderHandler::Init(const GameSettings& game, const boost::filesystem::p
err = translate("libloadorder failed to create a game handle. Details could not be fetched.").str();
} else {
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to create a game handle. Details: " << e;
err = translate("libloadorder failed to create a game handle. Details:").str() + " " + e;
err = (format(translate("libloadorder failed to create a game handle. Details: %1%")) % e).str();
}
lo_cleanup();
throw std::system_error(ret, libloadorder_category(), err);
@@ -103,7 +105,7 @@ bool LoadOrderHandler::IsPluginActive(const std::string& pluginName) const {
err = translate("libloadorder failed to check if a plugin is active. Details could not be fetched.").str();
} else {
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to check if a plugin is active. Details: " << e;
err = translate("libloadorder failed to check if a plugin is active. Details:").str() + " " + e;
err = (format(translate("libloadorder failed to check if a plugin is active. Details: %1%")) % e).str();
}
lo_cleanup();
throw std::system_error(ret, libloadorder_category(), err);
@@ -128,7 +130,7 @@ std::vector<std::string> LoadOrderHandler::GetLoadOrder() const {
err = translate("libloadorder failed to get the load order. Details could not be fetched.").str();
} else {
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to get the load order. Details: " << e;
err = translate("libloadorder failed to get the load order. Details:").str() + " " + e;
err = (format(translate("libloadorder failed to get the load order. Details: %1%")) % e).str();
}
lo_cleanup();
throw std::system_error(ret, libloadorder_category(), err);
@@ -168,7 +170,7 @@ void LoadOrderHandler::SetLoadOrder(const std::vector<std::string>& loadOrder) c
err = translate("libloadorder failed to set the load order. Details could not be fetched.").str();
} else {
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to set the load order. Details: " << e;
err = translate("libloadorder failed to set the load order. Details:").str() + " " + e;
err = (format(translate("libloadorder failed to set the load order. Details: %1%")) % e).str();
}
lo_cleanup();
+6 -9
View File
@@ -31,6 +31,7 @@
#include "backend/game/game.h"
#include "backend/helpers/git_helper.h"
using boost::format;
using boost::locale::translate;
using std::string;
@@ -41,7 +42,7 @@ MasterlistInfo Masterlist::GetInfo(const boost::filesystem::path& path, bool sho
// Compare HEAD and working copy, and get revision info.
GitHelper git;
MasterlistInfo info;
git.SetErrorMessage((boost::format(translate("An error occurred while trying to read the local masterlist's version. If this error happens again, try deleting the \".git\" folder in %1%.")) % path.parent_path().string()).str());
git.SetErrorMessage((format(translate("An error occurred while trying to read the local masterlist's version. If this error happens again, try deleting the \".git\" folder in %1%.")) % path.parent_path().string()).str());
if (!fs::exists(path)) {
BOOST_LOG_TRIVIAL(info) << "Unknown masterlist revision: No masterlist present.";
@@ -113,7 +114,7 @@ bool Masterlist::Update(const boost::filesystem::path& path, const std::string&
git.Clone(repoPath, repoUrl);
else {
// Repository exists: check settings are correct, then pull updates.
git.SetErrorMessage((boost::format(translate("An error occurred while trying to access the local masterlist repository. If this error happens again, try deleting the \".git\" folder in %1%.")) % repoPath.string()).str());
git.SetErrorMessage((format(translate("An error occurred while trying to access the local masterlist repository. If this error happens again, try deleting the \".git\" folder in %1%.")) % repoPath.string()).str());
// Open the repository.
BOOST_LOG_TRIVIAL(info) << "Existing repository found, attempting to open it.";
@@ -127,7 +128,7 @@ bool Masterlist::Update(const boost::filesystem::path& path, const std::string&
git.Fetch("origin");
// Check that a local branch with the correct name exists.
git.SetErrorMessage((boost::format(translate("An error occurred while trying to access the local masterlist repository. If this error happens again, try deleting the \".git\" folder in %1%.")) % repoPath.string()).str());
git.SetErrorMessage((format(translate("An error occurred while trying to access the local masterlist repository. If this error happens again, try deleting the \".git\" folder in %1%.")) % repoPath.string()).str());
int ret = git_branch_lookup(&git.GetData().reference, git.GetData().repo, repoBranch.c_str(), GIT_BRANCH_LOCAL);
if (ret == GIT_ENOTFOUND)
// Branch doesn't exist. Create a new branch using the remote branch's latest commit.
@@ -234,7 +235,7 @@ bool Masterlist::Update(const boost::filesystem::path& path, const std::string&
bool parsingFailed = false;
std::string parsingError;
git.SetErrorMessage((boost::format(translate("An error occurred while trying to read information on the updated masterlist. If this error happens again, try deleting the \".git\" folder in %1%.")) % repoPath.string()).str());
git.SetErrorMessage((format(translate("An error occurred while trying to read information on the updated masterlist. If this error happens again, try deleting the \".git\" folder in %1%.")) % repoPath.string()).str());
do {
// Get the HEAD revision's short ID.
string revision = git.GetHeadShortId();
@@ -248,11 +249,7 @@ bool Masterlist::Update(const boost::filesystem::path& path, const std::string&
} catch (std::exception& e) {
parsingFailed = true;
if (parsingError.empty())
parsingError = boost::locale::translate("Masterlist revision").str() +
" " + string(revision) +
": " + e.what() +
". " +
boost::locale::translate("The latest masterlist revision contains a syntax error, LOOT is using the most recent valid revision instead. Syntax errors are usually minor and fixed within hours.").str();
parsingError = (format(translate("Masterlist revision %1%: %2%. The latest masterlist revision contains a syntax error, LOOT is using the most recent valid revision instead. Syntax errors are usually minor and fixed within hours.")) % revision % e.what()).str();
//There was an error, roll back one revision.
BOOST_LOG_TRIVIAL(error) << "Masterlist parsing failed. Masterlist revision " + string(revision) + ": " + e.what();
+5 -2
View File
@@ -28,6 +28,9 @@
#include "backend/helpers/helpers.h"
using boost::format;
using boost::locale::translate;
namespace loot {
ConditionEvaluator::ConditionEvaluator(Game * game) : game_(game) {}
@@ -167,7 +170,7 @@ void ConditionEvaluator::validatePath(const boost::filesystem::path& path) {
if (component == ".." && temp.filename() == "..") {
BOOST_LOG_TRIVIAL(error) << "Invalid file path: " << path;
throw std::invalid_argument(boost::locale::translate("Invalid file path:").str() + " " + path.string());
throw std::invalid_argument((format(translate("Invalid file path: %1%")) % path.string()).str());
}
temp /= component;
@@ -177,7 +180,7 @@ void ConditionEvaluator::validateRegex(const std::string& regexString) {
try {
std::regex(regexString, std::regex::ECMAScript | std::regex::icase);
} catch (std::regex_error& e) {
throw std::invalid_argument((boost::format(boost::locale::translate("Invalid regex string \"%1%\": %2%")) % regexString % e.what()).str());
throw std::invalid_argument((format(translate("Invalid regex string \"%1%\": %2%")) % regexString % e.what()).str());
}
}