From 8f6bf9ff45f7e0c6d104c3b4c756f384d89ace9d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 14 Jun 2011 21:02:38 -0400 Subject: [PATCH] I18N - Localized a few more files. --- src/columns/ColDate.cpp | 5 ++++- src/columns/ColDepends.cpp | 11 +++++++---- src/columns/ColDescription.cpp | 15 +++++++++++---- src/en-US.h | 6 ++++++ 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/columns/ColDate.cpp b/src/columns/ColDate.cpp index 3ad6ecccb..4884dc887 100644 --- a/src/columns/ColDate.cpp +++ b/src/columns/ColDate.cpp @@ -25,6 +25,8 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include #include @@ -32,6 +34,7 @@ #include #include #include +#include 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); } } diff --git a/src/columns/ColDepends.cpp b/src/columns/ColDepends.cpp index 19c9b9665..e0b999605 100644 --- a/src/columns/ColDepends.cpp +++ b/src/columns/ColDepends.cpp @@ -25,10 +25,13 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include #include #include +#include #include 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); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColDescription.cpp b/src/columns/ColDescription.cpp index 5df963158..a88d1cfca 100644 --- a/src/columns/ColDescription.cpp +++ b/src/columns/ColDescription.cpp @@ -25,12 +25,15 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include #include #include #include #include +#include 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 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 ::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 diff --git a/src/en-US.h b/src/en-US.h index 50471b51b..b5394470f 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -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."