- Localized a few more files.
This commit is contained in:
Paul Beckingham 2011-06-14 21:02:38 -04:00
parent e0abee7f9f
commit 8f6bf9ff45
4 changed files with 28 additions and 9 deletions

View file

@ -25,6 +25,8 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <stdlib.h>
#include <math.h>
#include <Context.h>
@ -32,6 +34,7 @@
#include <Date.h>
#include <Duration.h>
#include <text.h>
#include <i18n.h>
extern Context context;
@ -93,7 +96,7 @@ void ColumnDate::measure (Task& task, int& minimum, int& maximum)
minimum = maximum = Duration (now - date).formatCompact ().length ();
}
else
throw std::string ("Unrecognized column format '") + _attribute + "." + _style + "'";
throw format (STRING_COLUMN_BAD_FORMAT, _attribute, _style);
}
}

View file

@ -25,10 +25,13 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <algorithm>
#include <Context.h>
#include <ColDepends.h>
#include <text.h>
#include <i18n.h>
#include <main.h>
extern Context context;
@ -38,7 +41,7 @@ ColumnDepends::ColumnDepends ()
{
_type = "string";
_style = "default";
_label = "Depends";
_label = STRING_COLUMN_LABEL_DEP;
}
////////////////////////////////////////////////////////////////////////////////
@ -53,8 +56,8 @@ void ColumnDepends::setStyle (const std::string& value)
{
_style = value;
if (_style == "indicator" && _label == "Depends") _label = _label.substr (0, context.config.get ("dependency.indicator").length ());
else if (_style == "count" && _label == "Depends") _label = "Dep";
if (_style == "indicator" && _label == STRING_COLUMN_LABEL_DEP) _label = _label.substr (0, context.config.get ("dependency.indicator").length ());
else if (_style == "count" && _label == STRING_COLUMN_LABEL_DEP) _label = STRING_COLUMN_LABEL_DEP_S;
}
////////////////////////////////////////////////////////////////////////////////
@ -90,7 +93,7 @@ void ColumnDepends::measure (Task& task, int& minimum, int& maximum)
}
}
else
throw std::string ("Unrecognized column format 'depends.") + _style + "'";
throw format (STRING_BAD_COLUMN_FORMAT, 'depends', _style);
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -25,12 +25,15 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <stdlib.h>
#include <Context.h>
#include <Date.h>
#include <ColDescription.h>
#include <text.h>
#include <util.h>
#include <i18n.h>
extern Context context;
@ -39,7 +42,7 @@ ColumnDescription::ColumnDescription ()
{
_type = "string";
_style = "default";
_label = "Description";
_label = STRING_COLUMN_LABEL_DESC;
}
////////////////////////////////////////////////////////////////////////////////
@ -124,7 +127,7 @@ void ColumnDescription::measure (Task& task, int& minimum, int& maximum)
}
else
throw std::string ("Unrecognized column format 'description.") + _style + "'";
throw format (STRING_COLUMN_BAD_FORMAT, "description.", _style);
}
////////////////////////////////////////////////////////////////////////////////
@ -141,11 +144,12 @@ void ColumnDescription::render (
// ...
if (_style == "default")
{
int indent = context.config.getInteger ("indent.annotation");
std::vector <Att> annos;
task.getAnnotations (annos);
if (annos.size ())
{
int indent = context.config.getInteger ("indent.annotation");
std::string format = context.config.get ("dateformat.annotation");
if (format == "")
format = context.config.get ("dateformat");
@ -163,7 +167,10 @@ void ColumnDescription::render (
std::vector <std::string>::iterator i;
for (i = raw.begin (); i != raw.end (); ++i)
lines.push_back (color.colorize (leftJustify (*i, width)));
if (i == raw.begin ())
lines.push_back (color.colorize (leftJustify (*i, width)));
else
lines.push_back (color.colorize (leftJustify (std::string (indent, ' ') + *i, width)));
}
// This is a description

View file

@ -95,6 +95,12 @@
#define STRING_API_WARNING "Warning: {1}"
#define STRING_API_ERROR "Error: {1}"
// Columns
#define STRING_COLUMN_BAD_FORMAT "Unrecognized column format '{1}.{2}'"
#define STRING_COLUMN_LABEL_DEP "Depends"
#define STRING_COLUMN_LABEL_DEP_S "Dep"
#define STRING_COLUMN_LABEL_DESC "Description"
// Config
#define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."