- Localized more files.
This commit is contained in:
Paul Beckingham 2011-06-25 23:32:40 -04:00
parent 42ead6b34d
commit c9cc43dc5f
9 changed files with 71 additions and 39 deletions

View file

@ -24,6 +24,9 @@
// USA
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <iostream>
#include <fstream>
#include <sstream>
@ -542,13 +545,13 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
if (included.readable ())
this->load (included, nest + 1);
else
throw std::string ("Could not read include file '") + included.data + "'.";
throw format (STRING_CONFIG_READ_INCLUDE, included.data);
}
else
throw std::string ("Can only include files with absolute paths, not '") + included.data + "'";
throw format (STRING_CONFIG_INCLUDE_PATH, included.data);
}
else
throw std::string ("Malformed entry '") + line + "'.";
throw format (STRING_CONFIG_BAD_ENTRY, line);
}
}
}
@ -585,7 +588,7 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data)
// Write out the new file.
if (! File::write (rc, contents.str ()))
throw std::string ("Could not write to '") + rc + "'.";
throw format (STRING_CONFIG_BAD_WRITE, rc);
}
////////////////////////////////////////////////////////////////////////////////
@ -699,8 +702,8 @@ std::string Config::checkForDeprecatedColor ()
std::stringstream out;
if (deprecated.size ())
{
out << "Your .taskrc file contains color settings that use deprecated "
<< "underscores. Please check:\n";
out << STRING_CONFIG_DEPRECATED_US
<< "\n";
std::vector <std::string>::iterator it2;
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
@ -734,8 +737,8 @@ std::string Config::checkForDeprecatedColumns ()
if (deprecated.size ())
{
out << "Your .taskrc file contains reports with deprecated columns. "
<< "Please check for entry_time, start_time or end_time in:\n";
out << STRING_CONFIG_DEPRECATED_COL
<< "\n";
std::vector <std::string>::iterator it2;
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)

View file

@ -25,6 +25,8 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <sstream>
#include <string>
#include <vector>
@ -33,6 +35,7 @@
#include <string.h>
#include <text.h>
#include <util.h>
#include <i18n.h>
#include <Duration.h>
static const char* durations[] =
@ -369,7 +372,7 @@ void Duration::parse (const std::string& input)
}
if (mSecs == 0)
throw std::string ("The duration '") + input + "' was not recognized.";
throw ::format (STRING_DURATION_UNRECOGNIZED, input);
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -25,6 +25,8 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <iostream>
#include <algorithm>
#include <Context.h>
@ -33,8 +35,6 @@
#include <text.h>
#include <i18n.h>
#define L10N // Localization complete.
extern Context context;
////////////////////////////////////////////////////////////////////////////////

View file

@ -25,8 +25,10 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream> // TODO Remove.
#define L10N // Localization complete.
#include <text.h>
#include <i18n.h>
#include <utf8.h>
#include <JSON.h>
@ -198,8 +200,7 @@ json::array* json::array::parse (Nibbler& nibbler)
else
{
delete arr;
throw std::string ("Error: missing value after ',' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_VALUE, (int) n.cursor ());
}
}
}
@ -210,8 +211,7 @@ json::array* json::array::parse (Nibbler& nibbler)
return arr;
}
else
throw std::string ("Error: missing ']' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_BRACKET, (int) n.cursor ());
delete arr;
}
@ -287,8 +287,7 @@ json::object* json::object::parse (Nibbler& nibbler)
else
{
delete obj;
throw std::string ("Error: missing value after ',' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_VALUE, (int) n.cursor ());
}
}
}
@ -299,8 +298,7 @@ json::object* json::object::parse (Nibbler& nibbler)
return obj;
}
else
throw std::string ("Error: missing '}' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_BRACE, (int) n.cursor ());
delete obj;
}
@ -328,12 +326,10 @@ bool json::object::parse_pair (
return true;
}
else
throw std::string ("Error: missing value at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_VALUE2, (int) n.cursor ());
}
else
throw std::string ("Error: missing ':' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_COLON, (int) n.cursor ());
}
return NULL;
@ -378,16 +374,14 @@ json::value* json::parse (const std::string& input)
if (n.next () == '{') root = json::object::parse (n);
else if (n.next () == '[') root = json::array::parse (n);
else
throw std::string ("Error: expected '{' or '[' at position ") +
format ((int)n.cursor ());
throw format (STRING_JSON_MISSING_OPEN, (int) n.cursor ());
// Check for end condition.
n.skipWS ();
if (!n.depleted ())
{
delete root;
throw std::string ("Error: extra characters found at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_EXTRA_CHARACTERS, (int) n.cursor ());
}
return root;

View file

@ -25,6 +25,8 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <iostream>
#include <Permission.h>
#include <Context.h>
@ -32,8 +34,6 @@
#include <text.h>
#include <i18n.h>
#define L10N // Localization complete.
extern Context context;
////////////////////////////////////////////////////////////////////////////////

View file

@ -25,12 +25,12 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <stdlib.h>
#include <string.h>
#include <RX.h>
#define L10N // Localization complete.
//#define _POSIX_C_SOURCE 1 // Forgot why this is here. Moving on...
////////////////////////////////////////////////////////////////////////////////

View file

@ -25,12 +25,15 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <algorithm>
#include <iostream>
#include <sstream>
#include <Context.h>
#include <text.h>
#include <util.h>
#include <i18n.h>
#include <main.h>
extern Context context;
@ -200,7 +203,9 @@ void dependencyChainOnComplete (Task& task)
// Nag about broken chain.
if (context.config.getBoolean ("dependency.reminder"))
{
std::cout << "Task " << task.id << " is blocked by:\n";
std::cout << format (STRING_DEPEND_BLOCKED, task.id)
<< "\n";
std::vector <Task>::iterator b;
for (b = blocking.begin (); b != blocking.end (); ++b)
std::cout << " " << b->id << " " << b->get ("description") << "\n";
@ -211,14 +216,16 @@ void dependencyChainOnComplete (Task& task)
{
if (context.config.getBoolean ("dependency.reminder"))
{
std::cout << "and is blocking:\n";
std::cout << STRING_DEPEND_BLOCKING
<< "\n";
std::vector <Task>::iterator b;
for (b = blocked.begin (); b != blocked.end (); ++b)
std::cout << " " << b->id << " " << b->get ("description") << "\n";
}
if (!context.config.getBoolean ("dependency.confirmation") ||
confirm ("Would you like the dependency chain fixed?"))
confirm (STRING_DEPEND_FIX_CHAIN))
{
// Repair the chain - everything in blocked should now depend on
// everything in blocking, instead of task.id.
@ -255,7 +262,9 @@ void dependencyChainOnStart (Task& task)
// broken chain.
if (blocking.size ())
{
std::cout << "Task " << task.id << " is blocked by:\n";
std::cout << format (STRING_DEPEND_BLOCKED, task.id)
<< "\n";
std::vector <Task>::iterator b;
for (b = blocking.begin (); b != blocking.end (); ++b)
std::cout << " " << b->id << " " << b->get ("description") << "\n";

View file

@ -217,16 +217,30 @@
// Config
#define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."
#define STRING_CONFIG_READ_INCLUDE "Could not read include file '{1}'."
#define STRING_CONFIG_INCLUDE_PATH "Can only include files with absolute paths, not '{1}'"
#define STRING_CONFIG_BAD_ENTRY "Malformed entry '{1}'."
#define STRING_CONFIG_BAD_WRITE "Could not write to '{1}'."
#define STRING_CONFIG_DEPRECATED_US "Your .taskrc file contains color settings that use deprecated underscores. Please check:"
#define STRING_CONFIG_DEPRECATED_COL "Your .taskrc file contains reports with deprecated columns. Please check for entry_time, start_time or end_time in:"
// Context
#define STRING_CONTEXT_CREATE_RC "A configuration file could not be found in {1}\n\nWould you like a sample {2} created, so taskwarrior can proceed?"
#define STRING_CONTEXT_NEED_RC "Cannot proceed without rc file."
// dependency
#define STRING_DEPEND_BLOCKED "Task {1} is blocked by:"
#define STRING_DEPEND_BLOCKING "and is blocking:"
#define STRING_DEPEND_FIX_CHAIN "Would you like the dependency chain fixed?"
// DOM
#define STRING_DOM_UNKNOWN "<unknown>"
#define STRING_DOM_UNREC "DOM: Cannot get unrecognized name '{1}'."
#define STRING_DOM_CANNOT_SET "DOM: Cannot set '{1}'."
// Duration
#define STRING_DURATION_UNRECOGNIZED "The duration '{1}' was not recognized."
// Errors
// TODO Move each of these to appropriate section.
#define STRING_UNKNOWN_ERROR "Unknown error."
@ -248,6 +262,15 @@
#define STRING_INTERACTIVE_WIDTH "Context::getWidth: determined width of {1} characters"
#define STRING_INTERACTIVE_HEIGHT "Context::getHeight: determined height of {1} characters"
// JSON
#define STRING_JSON_MISSING_VALUE "Error: missing value after ',' at position {1}"
#define STRING_JSON_MISSING_VALUE2 "Error: missing value at position {1}"
#define STRING_JSON_MISSING_BRACKET "Error: missing ']' at position {1}"
#define STRING_JSON_MISSING_BRACE "Error: missing '}' at position {1}"
#define STRING_JSON_MISSING_COLON "Error: missing ':' at position {1}"
#define STRING_JSON_MISSING_OPEN "Error: expected '{' or '[' at position {1}"
#define STRING_JSON_EXTRA_CHARACTERS "Error: extra characters found at position {1}"
// Lua
#define STRING_LUA_BAD_HOOK_DEF "Malformed hook definition '{1}'."
#define STRING_LUA_BAD_EVENT "Unrecognized hook event '{1}'."

View file

@ -24,6 +24,9 @@
// USA
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <iostream>
#include <stdlib.h>
#include <Context.h>
@ -32,8 +35,6 @@
#include <util.h>
#include <main.h>
#define L10N // Localization complete.
extern Context context;
static std::map <std::string, Color> gsColor;
@ -318,4 +319,3 @@ std::string colorizeDebug (const std::string& input)
}
////////////////////////////////////////////////////////////////////////////////