mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
I18N
- Localized custom reports.
This commit is contained in:
parent
376c79ef6f
commit
e56e670300
2 changed files with 21 additions and 19 deletions
|
@ -25,12 +25,15 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
#include <ViewTask.h>
|
#include <ViewTask.h>
|
||||||
|
#include <i18n.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
#include <CmdCustom.h>
|
#include <CmdCustom.h>
|
||||||
|
@ -69,8 +72,7 @@ int CmdCustom::execute (std::string& output)
|
||||||
split (labels, reportLabels, ',');
|
split (labels, reportLabels, ',');
|
||||||
|
|
||||||
if (columns.size () != labels.size () && labels.size () != 0)
|
if (columns.size () != labels.size () && labels.size () != 0)
|
||||||
throw std::string ("There are different numbers of columns and labels ") +
|
throw format (STRING_CMD_CUSTOM_MISMATCH, _keyword);
|
||||||
"for report '" + _keyword + "'.";
|
|
||||||
|
|
||||||
std::map <std::string, std::string> columnLabels;
|
std::map <std::string, std::string> columnLabels;
|
||||||
if (labels.size ())
|
if (labels.size ())
|
||||||
|
@ -158,21 +160,23 @@ int CmdCustom::execute (std::string& output)
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
<< view.render (filtered, sequence)
|
<< view.render (filtered, sequence)
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< filtered.size ()
|
<< (filtered.size () == 1
|
||||||
<< (filtered.size () == 1 ? " task" : " tasks");
|
? STRING_CMD_CUSTOM_COUNT
|
||||||
|
: format (STRING_CMD_CUSTOM_COUNTN, filtered.size ()));
|
||||||
|
|
||||||
if (maxrows && maxrows < (int)filtered.size ())
|
if (maxrows && maxrows < (int)filtered.size ())
|
||||||
out << ", " << maxrows << " shown";
|
out << ", " << format (STRING_CMD_CUSTOM_SHOWN, maxrows);
|
||||||
|
|
||||||
if (maxlines && maxlines < (int)filtered.size ())
|
if (maxlines && maxlines < (int)filtered.size ())
|
||||||
out << ", truncated to " << maxlines - table_header << " lines";
|
out << ", "
|
||||||
|
<< format (STRING_CMD_CUSTOM_TRUNCATED, maxlines - table_header);
|
||||||
|
|
||||||
out << "\n";
|
out << "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << "No matches."
|
out << STRING_FEEDBACK_NO_MATCH
|
||||||
<< std::endl;
|
<< std::endl; // Yes, flush required.
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,11 +213,7 @@ void CmdCustom::validateReportColumns (std::vector <std::string>& columns)
|
||||||
std::map <std::string, std::string>::iterator found = legacyMap.find (*i);
|
std::map <std::string, std::string>::iterator found = legacyMap.find (*i);
|
||||||
if (found != legacyMap.end ())
|
if (found != legacyMap.end ())
|
||||||
{
|
{
|
||||||
context.footnote (std::string ("Deprecated report field '")
|
context.footnote (format (STRING_CMD_CUSTOM_OLD_FIELD, *i, found->second));
|
||||||
+ *i
|
|
||||||
+ "' used. Please modify this to '"
|
|
||||||
+ found->second
|
|
||||||
+ "'.");
|
|
||||||
*i = found->second;
|
*i = found->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,11 +247,7 @@ void CmdCustom::validateSortColumns (std::vector <std::string>& columns)
|
||||||
std::map <std::string, std::string>::iterator found = legacyMap.find (*i);
|
std::map <std::string, std::string>::iterator found = legacyMap.find (*i);
|
||||||
if (found != legacyMap.end ())
|
if (found != legacyMap.end ())
|
||||||
{
|
{
|
||||||
context.footnote (std::string ("Deprecated sort field '")
|
context.footnote (format (STRING_CMD_CUSTOM_OLD_SORT, *i, found->second));
|
||||||
+ *i
|
|
||||||
+ "' used. Please modify this to '"
|
|
||||||
+ found->second
|
|
||||||
+ "'.");
|
|
||||||
*i = found->second;
|
*i = found->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,8 +377,14 @@
|
||||||
#define STRING_CMD_CONFIG_FILE_MOD "Config file {1} modified."
|
#define STRING_CMD_CONFIG_FILE_MOD "Config file {1} modified."
|
||||||
#define STRING_CMD_CONFIG_NO_CHANGE "No changes made."
|
#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_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_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
|
// Config
|
||||||
#define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."
|
#define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue