mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
I18N
- Localized more files.
This commit is contained in:
parent
42ead6b34d
commit
c9cc43dc5f
9 changed files with 71 additions and 39 deletions
|
@ -24,6 +24,9 @@
|
||||||
// USA
|
// USA
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -542,13 +545,13 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
|
||||||
if (included.readable ())
|
if (included.readable ())
|
||||||
this->load (included, nest + 1);
|
this->load (included, nest + 1);
|
||||||
else
|
else
|
||||||
throw std::string ("Could not read include file '") + included.data + "'.";
|
throw format (STRING_CONFIG_READ_INCLUDE, included.data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Can only include files with absolute paths, not '") + included.data + "'";
|
throw format (STRING_CONFIG_INCLUDE_PATH, included.data);
|
||||||
}
|
}
|
||||||
else
|
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.
|
// Write out the new file.
|
||||||
if (! File::write (rc, contents.str ()))
|
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;
|
std::stringstream out;
|
||||||
if (deprecated.size ())
|
if (deprecated.size ())
|
||||||
{
|
{
|
||||||
out << "Your .taskrc file contains color settings that use deprecated "
|
out << STRING_CONFIG_DEPRECATED_US
|
||||||
<< "underscores. Please check:\n";
|
<< "\n";
|
||||||
|
|
||||||
std::vector <std::string>::iterator it2;
|
std::vector <std::string>::iterator it2;
|
||||||
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
|
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
|
||||||
|
@ -734,8 +737,8 @@ std::string Config::checkForDeprecatedColumns ()
|
||||||
|
|
||||||
if (deprecated.size ())
|
if (deprecated.size ())
|
||||||
{
|
{
|
||||||
out << "Your .taskrc file contains reports with deprecated columns. "
|
out << STRING_CONFIG_DEPRECATED_COL
|
||||||
<< "Please check for entry_time, start_time or end_time in:\n";
|
<< "\n";
|
||||||
|
|
||||||
std::vector <std::string>::iterator it2;
|
std::vector <std::string>::iterator it2;
|
||||||
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
|
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -33,6 +35,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
#include <i18n.h>
|
||||||
#include <Duration.h>
|
#include <Duration.h>
|
||||||
|
|
||||||
static const char* durations[] =
|
static const char* durations[] =
|
||||||
|
@ -369,7 +372,7 @@ void Duration::parse (const std::string& input)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSecs == 0)
|
if (mSecs == 0)
|
||||||
throw std::string ("The duration '") + input + "' was not recognized.";
|
throw ::format (STRING_DURATION_UNRECOGNIZED, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
|
@ -33,8 +35,6 @@
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <i18n.h>
|
#include <i18n.h>
|
||||||
|
|
||||||
#define L10N // Localization complete.
|
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
28
src/JSON.cpp
28
src/JSON.cpp
|
@ -25,8 +25,10 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <iostream> // TODO Remove.
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
|
#include <i18n.h>
|
||||||
#include <utf8.h>
|
#include <utf8.h>
|
||||||
#include <JSON.h>
|
#include <JSON.h>
|
||||||
|
|
||||||
|
@ -198,8 +200,7 @@ json::array* json::array::parse (Nibbler& nibbler)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete arr;
|
delete arr;
|
||||||
throw std::string ("Error: missing value after ',' at position ") +
|
throw format (STRING_JSON_MISSING_VALUE, (int) n.cursor ());
|
||||||
format ((int) n.cursor ());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,8 +211,7 @@ json::array* json::array::parse (Nibbler& nibbler)
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Error: missing ']' at position ") +
|
throw format (STRING_JSON_MISSING_BRACKET, (int) n.cursor ());
|
||||||
format ((int) n.cursor ());
|
|
||||||
|
|
||||||
delete arr;
|
delete arr;
|
||||||
}
|
}
|
||||||
|
@ -287,8 +287,7 @@ json::object* json::object::parse (Nibbler& nibbler)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete obj;
|
delete obj;
|
||||||
throw std::string ("Error: missing value after ',' at position ") +
|
throw format (STRING_JSON_MISSING_VALUE, (int) n.cursor ());
|
||||||
format ((int) n.cursor ());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,8 +298,7 @@ json::object* json::object::parse (Nibbler& nibbler)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Error: missing '}' at position ") +
|
throw format (STRING_JSON_MISSING_BRACE, (int) n.cursor ());
|
||||||
format ((int) n.cursor ());
|
|
||||||
|
|
||||||
delete obj;
|
delete obj;
|
||||||
}
|
}
|
||||||
|
@ -328,12 +326,10 @@ bool json::object::parse_pair (
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Error: missing value at position ") +
|
throw format (STRING_JSON_MISSING_VALUE2, (int) n.cursor ());
|
||||||
format ((int) n.cursor ());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Error: missing ':' at position ") +
|
throw format (STRING_JSON_MISSING_COLON, (int) n.cursor ());
|
||||||
format ((int) n.cursor ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -378,16 +374,14 @@ json::value* json::parse (const std::string& input)
|
||||||
if (n.next () == '{') root = json::object::parse (n);
|
if (n.next () == '{') root = json::object::parse (n);
|
||||||
else if (n.next () == '[') root = json::array::parse (n);
|
else if (n.next () == '[') root = json::array::parse (n);
|
||||||
else
|
else
|
||||||
throw std::string ("Error: expected '{' or '[' at position ") +
|
throw format (STRING_JSON_MISSING_OPEN, (int) n.cursor ());
|
||||||
format ((int)n.cursor ());
|
|
||||||
|
|
||||||
// Check for end condition.
|
// Check for end condition.
|
||||||
n.skipWS ();
|
n.skipWS ();
|
||||||
if (!n.depleted ())
|
if (!n.depleted ())
|
||||||
{
|
{
|
||||||
delete root;
|
delete root;
|
||||||
throw std::string ("Error: extra characters found at position ") +
|
throw format (STRING_JSON_EXTRA_CHARACTERS, (int) n.cursor ());
|
||||||
format ((int) n.cursor ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <Permission.h>
|
#include <Permission.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
|
@ -32,8 +34,6 @@
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <i18n.h>
|
#include <i18n.h>
|
||||||
|
|
||||||
#define L10N // Localization complete.
|
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <RX.h>
|
#include <RX.h>
|
||||||
|
|
||||||
#define L10N // Localization complete.
|
|
||||||
|
|
||||||
//#define _POSIX_C_SOURCE 1 // Forgot why this is here. Moving on...
|
//#define _POSIX_C_SOURCE 1 // Forgot why this is here. Moving on...
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -25,12 +25,15 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
#include <i18n.h>
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
|
@ -200,7 +203,9 @@ void dependencyChainOnComplete (Task& task)
|
||||||
// Nag about broken chain.
|
// Nag about broken chain.
|
||||||
if (context.config.getBoolean ("dependency.reminder"))
|
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;
|
std::vector <Task>::iterator b;
|
||||||
for (b = blocking.begin (); b != blocking.end (); ++b)
|
for (b = blocking.begin (); b != blocking.end (); ++b)
|
||||||
std::cout << " " << b->id << " " << b->get ("description") << "\n";
|
std::cout << " " << b->id << " " << b->get ("description") << "\n";
|
||||||
|
@ -211,14 +216,16 @@ void dependencyChainOnComplete (Task& task)
|
||||||
{
|
{
|
||||||
if (context.config.getBoolean ("dependency.reminder"))
|
if (context.config.getBoolean ("dependency.reminder"))
|
||||||
{
|
{
|
||||||
std::cout << "and is blocking:\n";
|
std::cout << STRING_DEPEND_BLOCKING
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
std::vector <Task>::iterator b;
|
std::vector <Task>::iterator b;
|
||||||
for (b = blocked.begin (); b != blocked.end (); ++b)
|
for (b = blocked.begin (); b != blocked.end (); ++b)
|
||||||
std::cout << " " << b->id << " " << b->get ("description") << "\n";
|
std::cout << " " << b->id << " " << b->get ("description") << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!context.config.getBoolean ("dependency.confirmation") ||
|
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
|
// Repair the chain - everything in blocked should now depend on
|
||||||
// everything in blocking, instead of task.id.
|
// everything in blocking, instead of task.id.
|
||||||
|
@ -255,7 +262,9 @@ void dependencyChainOnStart (Task& task)
|
||||||
// broken chain.
|
// broken chain.
|
||||||
if (blocking.size ())
|
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;
|
std::vector <Task>::iterator b;
|
||||||
for (b = blocking.begin (); b != blocking.end (); ++b)
|
for (b = blocking.begin (); b != blocking.end (); ++b)
|
||||||
std::cout << " " << b->id << " " << b->get ("description") << "\n";
|
std::cout << " " << b->id << " " << b->get ("description") << "\n";
|
||||||
|
|
23
src/en-US.h
23
src/en-US.h
|
@ -217,16 +217,30 @@
|
||||||
|
|
||||||
// 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."
|
||||||
|
#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
|
// 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_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."
|
#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
|
// DOM
|
||||||
#define STRING_DOM_UNKNOWN "<unknown>"
|
#define STRING_DOM_UNKNOWN "<unknown>"
|
||||||
#define STRING_DOM_UNREC "DOM: Cannot get unrecognized name '{1}'."
|
#define STRING_DOM_UNREC "DOM: Cannot get unrecognized name '{1}'."
|
||||||
#define STRING_DOM_CANNOT_SET "DOM: Cannot set '{1}'."
|
#define STRING_DOM_CANNOT_SET "DOM: Cannot set '{1}'."
|
||||||
|
|
||||||
|
// Duration
|
||||||
|
#define STRING_DURATION_UNRECOGNIZED "The duration '{1}' was not recognized."
|
||||||
|
|
||||||
// Errors
|
// Errors
|
||||||
// TODO Move each of these to appropriate section.
|
// TODO Move each of these to appropriate section.
|
||||||
#define STRING_UNKNOWN_ERROR "Unknown error."
|
#define STRING_UNKNOWN_ERROR "Unknown error."
|
||||||
|
@ -248,6 +262,15 @@
|
||||||
#define STRING_INTERACTIVE_WIDTH "Context::getWidth: determined width of {1} characters"
|
#define STRING_INTERACTIVE_WIDTH "Context::getWidth: determined width of {1} characters"
|
||||||
#define STRING_INTERACTIVE_HEIGHT "Context::getHeight: determined height 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
|
// Lua
|
||||||
#define STRING_LUA_BAD_HOOK_DEF "Malformed hook definition '{1}'."
|
#define STRING_LUA_BAD_HOOK_DEF "Malformed hook definition '{1}'."
|
||||||
#define STRING_LUA_BAD_EVENT "Unrecognized hook event '{1}'."
|
#define STRING_LUA_BAD_EVENT "Unrecognized hook event '{1}'."
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
// USA
|
// USA
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
|
@ -32,8 +35,6 @@
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
|
|
||||||
#define L10N // Localization complete.
|
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
|
|
||||||
static std::map <std::string, Color> gsColor;
|
static std::map <std::string, Color> gsColor;
|
||||||
|
@ -318,4 +319,3 @@ std::string colorizeDebug (const std::string& input)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue