diff --git a/src/Context.cpp b/src/Context.cpp index 4df8ac596..df915d07a 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -385,13 +385,8 @@ void Context::createDefaultConfig () // Do we need to create a default rc? if (! rc_file.exists ()) { - if (!confirm ("A configuration file could not be found in " // TODO i18n - + home_dir - + "\n\n" - + "Would you like a sample " - + rc_file.data - + " created, so taskwarrior can proceed?")) - throw std::string ("Cannot proceed without rc file."); + if (!confirm (format (STRING_CONTEXT_CREATE_RC, home_dir, rc_file.data))) + throw std::string (STRING_CONTEXT_NEED_RC); config.createDefaultRC (rc_file, data_dir); } diff --git a/src/Hooks.cpp b/src/Hooks.cpp index 65da22182..731c204c6 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -30,6 +30,9 @@ #include #include #include +#include + +#define L10N // Localization complete. extern Context context; @@ -143,7 +146,7 @@ void Hooks::initialize () (void) n.skip (','); } else - throw std::string ("Malformed hook definition '") + *it + "'."; + throw std::string (format (STRING_LUA_BAD_HOOK_DEF, *it)); } } } @@ -171,7 +174,7 @@ bool Hooks::trigger (const std::string& event) return false; } else - throw std::string ("Unrecognized hook event '") + event + "'."; + throw std::string (format (STRING_LUA_BAD_EVENT, event)); } } #endif @@ -198,7 +201,7 @@ bool Hooks::trigger (const std::string& event, Task& task) return false; } else - throw std::string ("Unrecognized hook event '") + event + "'."; + throw std::string (format (STRING_LUA_BAD_EVENT, event)); } } #endif @@ -215,6 +218,7 @@ bool Hooks::validProgramEvent (const std::string& event) return false; } +//////////////////////////////////////////////////////////////////////////////// bool Hooks::validTaskEvent (const std::string& event) { if (std::find (validTaskEvents.begin (), validTaskEvents.end (), event) != validTaskEvents.end ()) diff --git a/src/en-US.h b/src/en-US.h index 304fba3f0..92cbe5c66 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -108,10 +108,18 @@ #define STRING_CMD_SHOW_CONF_VAR "Config Variable" #define STRING_CMD_SHOW_CONF_VALUE "Value" +// 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." + // DOM #define STRING_DOM_UNKNOWN "" #define STRING_DOM_UNREC "DOM: Cannot get unrecognized name '{1}'." #define STRING_DOM_CANNOT_SET "DOM: Cannot set '{1}'." +// Lua +#define STRING_LUA_BAD_HOOK_DEF "Malformed hook definition '{1}'." +#define STRING_LUA_BAD_EVENT "Unrecognized hook event '{1}'." + #endif