diff --git a/src/commands/CmdContext.cpp b/src/commands/CmdContext.cpp index 0d940e98d..93463c4ee 100644 --- a/src/commands/CmdContext.cpp +++ b/src/commands/CmdContext.cpp @@ -140,15 +140,15 @@ int CmdContext::defineContext (std::vector & words, std::stringstre bool success = CmdConfig::setConfigVariable(name, value, confirmation); if (success) - out << "Context '" << words[1] << "' defined." << "\n"; + out << format (STRING_CMD_CONTEXT_DEF_SUCC, words[1]) << "\n"; else { - out << "Context '" << words[1] << "' was not defined." << "\n"; + out << format (STRING_CMD_CONTEXT_DEF_FAIL, words[1]) << "\n"; rc = 1; } } else - throw "Both context name and its definition must be provided."; + throw STRING_CMD_CONTEXT_DEF_USAG; return rc; } @@ -183,12 +183,12 @@ int CmdContext::deleteContext (std::vector & words, std::stringstre // Output feedback if (rc == 0) - out << "Context '" << words[1] << "' undefined." << "\n"; + out << format (STRING_CMD_CONTEXT_DEL_SUCC, words[1]) << "\n"; else - out << "Context '" << words[1] << "' was not undefined." << "\n"; + out << format (STRING_CMD_CONTEXT_DEL_FAIL, words[1]) << "\n"; } else - throw "Context name needs to be specified."; + throw STRING_CMD_CONTEXT_DEL_USAG; return rc; } @@ -234,7 +234,7 @@ int CmdContext::listContexts (std::vector & words, std::stringstrea } else { - out << "No contexts defined." << "\n"; + out << STRING_CMD_CONTEXT_LIST_EMPT << "\n"; rc = 1; } @@ -260,17 +260,17 @@ int CmdContext::setContext (std::vector & words, std::stringstream& // Check that the specified context is defined if (std::find (contexts.begin (), contexts.end (), value) == contexts.end()) - throw format ("Context '{1}' not found.", value); + throw format (STRING_CMD_CONTEXT_SET_NFOU, value); // Set the active context. // Should always succeed, as we do not require confirmation. bool success = CmdConfig::setConfigVariable("context", value, false); if (success) - out << "Context '" << value << "' applied." << "\n"; + out << format (STRING_CMD_CONTEXT_SET_SUCC, value) << "\n"; else { - out << "Context '" << value << "' was not applied." << "\n"; + out << format (STRING_CMD_CONTEXT_SET_FAIL, value) << "\n"; rc = 1; } @@ -290,11 +290,11 @@ int CmdContext::showContext (std::vector & words, std::stringstream std::string currentContext = context.config.get ("context"); if (currentContext == "") - out << "No context is currently applied." << "\n"; + out << STRING_CMD_CONTEXT_SHOW_EMPT << "\n"; else { std::string currentFilter = context.config.get ("context." + currentContext); - out << format ("Context '{1}' with filter '{2}' is currently applied.", currentContext, currentFilter) << "\n"; + out << format (STRING_CMD_CONTEXT_SHOW, currentContext, currentFilter) << "\n"; } return 0; @@ -316,10 +316,10 @@ int CmdContext::unsetContext (std::vector & words, std::stringstrea int status = CmdConfig::unsetConfigVariable("context", false); if (status == 0) - out << "Context unset." << "\n"; + out << STRING_CMD_CONTEXT_NON_SUCC << "\n"; else { - out << "Context not unset." << "\n"; + out << STRING_CMD_CONTEXT_NON_FAIL << "\n"; rc = 1; } diff --git a/src/l10n/eng-USA.h b/src/l10n/eng-USA.h index 68feb65c7..cc7838142 100644 --- a/src/l10n/eng-USA.h +++ b/src/l10n/eng-USA.h @@ -562,6 +562,20 @@ #define STRING_CMD_CONFIG_NO_NAME "Specify the name of a config variable to modify." #define STRING_CMD_HCONFIG_USAGE "Lists all supported configuration variables, for completion purposes" #define STRING_CMD_CONTEXT_USAGE "Set and define contexts (default filters)" +#define STRING_CMD_CONTEXT_DEF_SUCC "Context '{1}' defined." +#define STRING_CMD_CONTEXT_DEF_FAIL "Context '{1}' not defined." +#define STRING_CMD_CONTEXT_DEF_USAG "Both context name and its definition must be provided." +#define STRING_CMD_CONTEXT_DEL_SUCC "Context '{1}' deleted." +#define STRING_CMD_CONTEXT_DEL_FAIL "Context '{1}' not deleted." +#define STRING_CMD_CONTEXT_DEL_USAG "Context name needs to be specified." +#define STRING_CMD_CONTEXT_LIST_EMPT "No contexts defined." +#define STRING_CMD_CONTEXT_SET_NFOU "Context '{1}' not found." +#define STRING_CMD_CONTEXT_SET_SUCC "Context '{1}' applied." +#define STRING_CMD_CONTEXT_SET_FAIL "Context '{1}' not applied." +#define STRING_CMD_CONTEXT_SHOW_EMPT "No context is currently applied." +#define STRING_CMD_CONTEXT_SHOW "Context '{1}' with filter '{2}' is currently applied." +#define STRING_CMD_CONTEXT_NON_SUCC "Context unset." +#define STRING_CMD_CONTEXT_NON_FAIL "Context not unset." #define STRING_CMD_HCONTEXT_USAGE "Lists all supported contexts, for completion purposes" #define STRING_CMD_CUSTOM_MISMATCH "There are different numbers of columns and labels for report '{1}'." #define STRING_CMD_CUSTOM_SHOWN "{1} shown"