diff --git a/src/commands/CmdCustom.cpp b/src/commands/CmdCustom.cpp index 0d0022aa3..bfbf7a513 100644 --- a/src/commands/CmdCustom.cpp +++ b/src/commands/CmdCustom.cpp @@ -25,12 +25,15 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include #include #include #include #include +#include #include #include #include @@ -69,8 +72,7 @@ int CmdCustom::execute (std::string& output) split (labels, reportLabels, ','); if (columns.size () != labels.size () && labels.size () != 0) - throw std::string ("There are different numbers of columns and labels ") + - "for report '" + _keyword + "'."; + throw format (STRING_CMD_CUSTOM_MISMATCH, _keyword); std::map columnLabels; if (labels.size ()) @@ -158,21 +160,23 @@ int CmdCustom::execute (std::string& output) out << optionalBlankLine () << view.render (filtered, sequence) << optionalBlankLine () - << filtered.size () - << (filtered.size () == 1 ? " task" : " tasks"); + << (filtered.size () == 1 + ? STRING_CMD_CUSTOM_COUNT + : format (STRING_CMD_CUSTOM_COUNTN, filtered.size ())); if (maxrows && maxrows < (int)filtered.size ()) - out << ", " << maxrows << " shown"; + out << ", " << format (STRING_CMD_CUSTOM_SHOWN, maxrows); if (maxlines && maxlines < (int)filtered.size ()) - out << ", truncated to " << maxlines - table_header << " lines"; + out << ", " + << format (STRING_CMD_CUSTOM_TRUNCATED, maxlines - table_header); out << "\n"; } else { - out << "No matches." - << std::endl; + out << STRING_FEEDBACK_NO_MATCH + << std::endl; // Yes, flush required. rc = 1; } @@ -209,11 +213,7 @@ void CmdCustom::validateReportColumns (std::vector & columns) std::map ::iterator found = legacyMap.find (*i); if (found != legacyMap.end ()) { - context.footnote (std::string ("Deprecated report field '") - + *i - + "' used. Please modify this to '" - + found->second - + "'."); + context.footnote (format (STRING_CMD_CUSTOM_OLD_FIELD, *i, found->second)); *i = found->second; } } @@ -247,11 +247,7 @@ void CmdCustom::validateSortColumns (std::vector & columns) std::map ::iterator found = legacyMap.find (*i); if (found != legacyMap.end ()) { - context.footnote (std::string ("Deprecated sort field '") - + *i - + "' used. Please modify this to '" - + found->second - + "'."); + context.footnote (format (STRING_CMD_CUSTOM_OLD_SORT, *i, found->second)); *i = found->second; } } diff --git a/src/en-US.h b/src/en-US.h index ac869ad6a..e5416d741 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -377,8 +377,14 @@ #define STRING_CMD_CONFIG_FILE_MOD "Config file {1} modified." #define STRING_CMD_CONFIG_NO_CHANGE "No changes made." #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_CUSTOM_MISMATCH "There are different numbers of columns and labels for report '{1}'." +#define STRING_CMD_CUSTOM_OLD_SORT "Deprecated sort field '{1}' used. Please modify this to '{2}'." +#define STRING_CMD_CUSTOM_OLD_FIELD "Deprecated report field '{1}' used. Please modify this to '{2}'." +#define STRING_CMD_CUSTOM_SHOWN "{1} shown" +#define STRING_CMD_CUSTOM_COUNT "1 task" +#define STRING_CMD_CUSTOM_COUNTN "{1} tasks" +#define STRING_CMD_CUSTOM_TRUNCATED "truncated to {1} lines" // Config #define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."