L10N
- Localized all column objects, some commands.
This commit is contained in:
@@ -25,19 +25,22 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <Context.h>
|
||||
#include <ColDue.h>
|
||||
#include <Date.h>
|
||||
#include <Duration.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnDue::ColumnDue ()
|
||||
{
|
||||
_label = "Due";
|
||||
_label = STRING_COLUMN_LABEL_DUE;
|
||||
_attribute = "due";
|
||||
}
|
||||
|
||||
@@ -53,8 +56,8 @@ void ColumnDue::setStyle (const std::string& value)
|
||||
{
|
||||
_style = value;
|
||||
|
||||
if (_style == "countdown" && _label == "Due")
|
||||
_label = "Countdown";
|
||||
if (_style == "countdown" && _label == STRING_COLUMN_LABEL_DUE)
|
||||
_label = STRING_COLUMN_LABEL_COUNT;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,12 +25,15 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <ColEnd.h>
|
||||
#include <i18n.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnEnd::ColumnEnd ()
|
||||
{
|
||||
_label = "Completed";
|
||||
_label = STRING_COLUMN_LABEL_COMPLETE;
|
||||
_attribute = "end";
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,15 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <ColEntry.h>
|
||||
#include <i18n.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnEntry::ColumnEntry ()
|
||||
{
|
||||
_label = "Added";
|
||||
_label = STRING_COLUMN_LABEL_ADDED;
|
||||
_attribute = "entry";
|
||||
}
|
||||
|
||||
@@ -46,7 +49,9 @@ void ColumnEntry::setStyle (const std::string& value)
|
||||
{
|
||||
_style = value;
|
||||
|
||||
if (_style == "age" && _label == "Added") _label = "Age";
|
||||
if (_style == "age" &&
|
||||
_label == STRING_COLUMN_LABEL_ADDED)
|
||||
_label = STRING_COLUMN_LABEL_AGE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,10 +25,13 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <math.h>
|
||||
#include <Context.h>
|
||||
#include <ColID.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -37,7 +40,7 @@ ColumnID::ColumnID ()
|
||||
{
|
||||
_type = "number";
|
||||
_style = "default";
|
||||
_label = "ID";
|
||||
_label = STRING_COLUMN_LABEL_ID;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -60,7 +63,7 @@ void ColumnID::measure (Task& task, int& minimum, int& maximum)
|
||||
minimum = maximum = length;
|
||||
|
||||
if (_style != "default")
|
||||
throw std::string ("Unrecognized column format 'id.") + _style + "'";
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "id", _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <Context.h>
|
||||
#include <ColPriority.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -36,7 +39,7 @@ ColumnPriority::ColumnPriority ()
|
||||
{
|
||||
_type = "string";
|
||||
_style = "default";
|
||||
_label = "Pri";
|
||||
_label = STRING_COLUMN_LABEL_PRI;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -51,8 +54,8 @@ void ColumnPriority::setStyle (const std::string& value)
|
||||
{
|
||||
_style = value;
|
||||
|
||||
if (_style == "long" && _label == "Pri")
|
||||
_label = "Priority";
|
||||
if (_style == "long" && _label == STRING_COLUMN_LABEL_PRI)
|
||||
_label = STRING_COLUMN_LABEL_PRIORITY;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -69,7 +72,7 @@ void ColumnPriority::measure (Task& task, int& minimum, int& maximum)
|
||||
else if (priority == "L") minimum = maximum = 3;
|
||||
}
|
||||
else if (_style != "default")
|
||||
throw std::string ("Unrecognized column format 'priority.") + _style + "'";
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "priority", _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <Context.h>
|
||||
#include <ColProject.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -36,7 +39,7 @@ ColumnProject::ColumnProject ()
|
||||
{
|
||||
_type = "string";
|
||||
_style = "default";
|
||||
_label = "Project";
|
||||
_label = STRING_COLUMN_LABEL_PROJECT;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -57,7 +60,7 @@ void ColumnProject::measure (Task& task, int& minimum, int& maximum)
|
||||
project = project.substr (0, period);
|
||||
}
|
||||
else if (_style != "default")
|
||||
throw std::string ("Unrecognized column format 'project.") + _style + "'";
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "project.", _style);
|
||||
|
||||
minimum = longestWord (project);
|
||||
maximum = project.length ();
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <Context.h>
|
||||
#include <ColRecur.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -36,7 +39,7 @@ ColumnRecur::ColumnRecur ()
|
||||
{
|
||||
_type = "string";
|
||||
_style = "default";
|
||||
_label = "Recur";
|
||||
_label = STRING_COLUMN_LABEL_RECUR;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -51,7 +54,7 @@ void ColumnRecur::setStyle (const std::string& value)
|
||||
{
|
||||
_style = value;
|
||||
|
||||
if (_style == "indicator" && _label == "Recur")
|
||||
if (_style == "indicator" && _label == STRING_COLUMN_LABEL_RECUR)
|
||||
_label = _label.substr (0, context.config.get ("recurrence.indicator").length ());
|
||||
}
|
||||
|
||||
@@ -69,7 +72,7 @@ void ColumnRecur::measure (Task& task, int& minimum, int& maximum)
|
||||
minimum = maximum = context.config.get ("recurrence.indicator").length ();
|
||||
}
|
||||
else
|
||||
throw std::string ("Unrecognized column format 'recur.") + _style + "'";
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "recur.", _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,16 +25,19 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <Context.h>
|
||||
#include <ColStart.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnStart::ColumnStart ()
|
||||
{
|
||||
_label = "Started";
|
||||
_label = STRING_COLUMN_LABEL_STARTED;
|
||||
_attribute = "start";
|
||||
}
|
||||
|
||||
@@ -50,8 +53,8 @@ void ColumnStart::setStyle (const std::string& value)
|
||||
{
|
||||
_style = value;
|
||||
|
||||
if (_style == "active" && _label == "Started")
|
||||
_label = "A";
|
||||
if (_style == "active" && _label == STRING_COLUMN_LABEL_STARTED)
|
||||
_label = STRING_COLUMN_LABEL_ACTIVE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <Context.h>
|
||||
#include <ColStatus.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -36,7 +39,7 @@ ColumnStatus::ColumnStatus ()
|
||||
{
|
||||
_type = "string";
|
||||
_style = "default";
|
||||
_label = "Status";
|
||||
_label = STRING_COLUMN_LABEL_STATUS;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -51,8 +54,8 @@ void ColumnStatus::setStyle (const std::string& value)
|
||||
{
|
||||
_style = value;
|
||||
|
||||
if (_style == "short" && _label == "Status")
|
||||
_label = "St";
|
||||
if (_style == "short" && _label == STRING_COLUMN_LABEL_STATUS)
|
||||
_label = STRING_COLUMN_LABEL_STAT;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -78,7 +81,7 @@ void ColumnStatus::measure (Task& task, int& minimum, int& maximum)
|
||||
else if (_style == "short")
|
||||
minimum = maximum = 1;
|
||||
else
|
||||
throw std::string ("Unrecognized column format 'status.") + _style + "'";
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "status.", _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -93,20 +96,20 @@ void ColumnStatus::render (
|
||||
|
||||
if (_style == "default")
|
||||
{
|
||||
if (status == Task::pending) value = "Pending";
|
||||
else if (status == Task::completed) value = "Completed";
|
||||
else if (status == Task::deleted) value = "Deleted";
|
||||
else if (status == Task::waiting) value = "Waiting";
|
||||
else if (status == Task::recurring) value = "Recurring";
|
||||
if (status == Task::pending) value = STRING_COLUMN_LABEL_STAT_PE;
|
||||
else if (status == Task::completed) value = STRING_COLUMN_LABEL_STAT_CO;
|
||||
else if (status == Task::deleted) value = STRING_COLUMN_LABEL_STAT_DE;
|
||||
else if (status == Task::waiting) value = STRING_COLUMN_LABEL_STAT_WA;
|
||||
else if (status == Task::recurring) value = STRING_COLUMN_LABEL_STAT_RE;
|
||||
}
|
||||
|
||||
else if (_style == "short")
|
||||
{
|
||||
if (status == Task::pending) value = "P";
|
||||
else if (status == Task::completed) value = "C";
|
||||
else if (status == Task::deleted) value = "D";
|
||||
else if (status == Task::waiting) value = "W";
|
||||
else if (status == Task::recurring) value = "R";
|
||||
if (status == Task::pending) value = STRING_COLUMN_LABEL_STAT_P;
|
||||
else if (status == Task::completed) value = STRING_COLUMN_LABEL_STAT_C;
|
||||
else if (status == Task::deleted) value = STRING_COLUMN_LABEL_STAT_D;
|
||||
else if (status == Task::waiting) value = STRING_COLUMN_LABEL_STAT_W;
|
||||
else if (status == Task::recurring) value = STRING_COLUMN_LABEL_STAT_R;
|
||||
}
|
||||
|
||||
lines.push_back (color.colorize (leftJustify (value, width)));
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <Context.h>
|
||||
#include <ColString.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -69,7 +72,7 @@ void ColumnString::measure (const std::string& value, int& minimum, int& maximum
|
||||
_style == "right_fixed")
|
||||
minimum = maximum = strippedLength (value);
|
||||
else
|
||||
throw std::string ("Unrecognized column format 'string.") + _style + "'";
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "string.", _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,10 +25,13 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <algorithm>
|
||||
#include <Context.h>
|
||||
#include <ColTags.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -37,7 +40,7 @@ ColumnTags::ColumnTags ()
|
||||
{
|
||||
_type = "string";
|
||||
_style = "default";
|
||||
_label = "Tags";
|
||||
_label = STRING_COLUMN_LABEL_TAGS;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -52,8 +55,13 @@ void ColumnTags::setStyle (const std::string& value)
|
||||
{
|
||||
_style = value;
|
||||
|
||||
if (_style == "indicator" && _label == "Tags") _label = _label.substr (0, context.config.get ("tag.indicator").length ());
|
||||
else if (_style == "count" && _label == "Tags") _label = "Tag";
|
||||
if (_style == "indicator" &&
|
||||
_label == STRING_COLUMN_LABEL_TAGS)
|
||||
_label = _label.substr (0, context.config.get ("tag.indicator").length ());
|
||||
|
||||
else if (_style == "count" &&
|
||||
_label == STRING_COLUMN_LABEL_TAGS)
|
||||
_label = STRING_COLUMN_LABEL_TAG;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -80,8 +88,7 @@ void ColumnTags::measure (Task& task, int& minimum, int& maximum)
|
||||
}
|
||||
}
|
||||
else
|
||||
throw std::string ("Unrecognized column format 'tags.") + _style + "'";
|
||||
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "tags.", _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,10 +25,13 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <math.h>
|
||||
#include <Context.h>
|
||||
#include <ColUUID.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -37,7 +40,7 @@ ColumnUUID::ColumnUUID ()
|
||||
{
|
||||
_type = "string";
|
||||
_style = "default";
|
||||
_label = "UUID";
|
||||
_label = STRING_COLUMN_LABEL_UUID;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -52,7 +55,7 @@ void ColumnUUID::measure (Task&, int& minimum, int& maximum)
|
||||
if (_style == "default") minimum = maximum = 36;
|
||||
else if (_style == "short") minimum = maximum = 8;
|
||||
else
|
||||
throw std::string ("Unrecognized column format 'uuid.") + _style + "'";
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "uuid.", _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,12 +25,15 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <ColUntil.h>
|
||||
#include <i18n.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnUntil::ColumnUntil ()
|
||||
{
|
||||
_label = "Until";
|
||||
_label = STRING_COLUMN_LABEL_UNTIL;
|
||||
_attribute = "until";
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <Context.h>
|
||||
#include <ColUrgency.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -36,7 +39,7 @@ ColumnUrgency::ColumnUrgency ()
|
||||
{
|
||||
_type = "number";
|
||||
_style = "default";
|
||||
_label = "Urgency";
|
||||
_label = STRING_COLUMN_LABEL_URGENCY;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -51,7 +54,7 @@ void ColumnUrgency::measure (Task& task, int& minimum, int& maximum)
|
||||
minimum = maximum = format (task.urgency (), 4, 3).length ();
|
||||
|
||||
if (_style != "default")
|
||||
throw std::string ("Unrecognized column format 'urgency.") + _style + "'";
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "urgency.", _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,12 +25,15 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <ColWait.h>
|
||||
#include <i18n.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnWait::ColumnWait ()
|
||||
{
|
||||
_label = "Wait";
|
||||
_label = STRING_COLUMN_LABEL_WAIT;
|
||||
_attribute = "wait";
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <Context.h>
|
||||
#include <Column.h>
|
||||
#include <ColDepends.h>
|
||||
@@ -45,6 +47,7 @@
|
||||
#include <ColUUID.h>
|
||||
#include <ColWait.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -91,7 +94,7 @@ Column* Column::factory (const std::string& name, const std::string& report)
|
||||
// Special non-task column
|
||||
else if (column_name == "string") column = new ColumnString ();
|
||||
else
|
||||
throw std::string ("Unrecognized column name '") + column_name + "'.";
|
||||
throw format (STRING_COLUMN_BAD_NAME, column_name);
|
||||
|
||||
column->setReport (report);
|
||||
column->setStyle (column_style);
|
||||
@@ -174,24 +177,28 @@ void Column::renderHeader (
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// No L10N.
|
||||
void Column::measure (const std::string&, int&, int&)
|
||||
{
|
||||
throw std::string ("Virtual method Column::measure not overriden.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// No L10N.
|
||||
void Column::measure (Task&, int&, int&)
|
||||
{
|
||||
throw std::string ("Virtual method Column::measure not overriden.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// No L10N.
|
||||
void Column::render (std::vector <std::string>&, const std::string&, int, Color&)
|
||||
{
|
||||
throw std::string ("Virtual method Column::render not overriden.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// No L10N.
|
||||
void Column::render (std::vector <std::string>&, Task&, int, Color&)
|
||||
{
|
||||
throw std::string ("Virtual method Column::render not overriden.");
|
||||
|
||||
Reference in New Issue
Block a user