diff --git a/src/commands/CmdDiagnostics.cpp b/src/commands/CmdDiagnostics.cpp index a21200d4e..6a2bc79c1 100644 --- a/src/commands/CmdDiagnostics.cpp +++ b/src/commands/CmdDiagnostics.cpp @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -51,7 +53,7 @@ CmdDiagnostics::CmdDiagnostics () { _keyword = "diagnostics"; _usage = "task diagnostics"; - _description = "Shows information needed when reporting a problem."; + _description = STRING_CMD_DIAG_USAGE; _read_only = true; _displays_id = false; } @@ -70,7 +72,7 @@ int CmdDiagnostics::execute (std::string& output) << bold.colorize (PACKAGE_STRING) << "\n"; - out << " Platform: " + out << " " << STRING_CMD_DIAG_PLATFORM << ": " << #if defined (DARWIN) "Darwin" @@ -87,17 +89,18 @@ int CmdDiagnostics::execute (std::string& output) #elif defined (LINUX) "Linux" #else - "" + STRING_CMD_DIAG_UNKNOWN #endif << "\n\n"; // Compiler. - out << bold.colorize ("Compiler") + out << bold.colorize (STRING_CMD_DIAG_COMPILER) << "\n" #ifdef __VERSION__ - << " Version: " << __VERSION__ << "\n" + << " " << STRING_CMD_DIAG_VERSION << ": " + << __VERSION__ << "\n" #endif - << " Caps:" + << " " << STRING_CMD_DIAG_CAPS << ":" #ifdef __STDC__ << " +stdc" #endif @@ -125,7 +128,7 @@ int CmdDiagnostics::execute (std::string& output) << " +vp" << sizeof (void*) << "\n\n"; - out << bold.colorize ("Libraries") + out << bold.colorize (STRING_CMD_DIAG_LIBRARIES) << "\n"; out << " Lua: " @@ -136,14 +139,14 @@ int CmdDiagnostics::execute (std::string& output) #endif << "\n\n"; - out << bold.colorize ("Build Features") + out << bold.colorize (STRING_CMD_DIAG_FEATURES) << "\n" // Build date. - << " Built: " << __DATE__ << " " << __TIME__ << "\n" - << " Commit: " << COMMIT << "\n" + << " " << STRING_CMD_DIAG_BUILT << ": " << __DATE__ << " " << __TIME__ << "\n" + << " " << STRING_CMD_DIAG_COMMIT << ": " << COMMIT << "\n" << " CMake: " << CMAKE_VERSION << "\n" - << " Caps:" + << " " << STRING_CMD_DIAG_CAPS << ":" #ifdef HAVE_LIBPTHREAD << " +pthreads" #else diff --git a/src/commands/CmdPull.cpp b/src/commands/CmdPull.cpp index 057c16513..d83983103 100644 --- a/src/commands/CmdPull.cpp +++ b/src/commands/CmdPull.cpp @@ -25,11 +25,14 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include #include #include #include +#include #include #include @@ -40,7 +43,7 @@ CmdPull::CmdPull () { _keyword = "pull"; _usage = "task pull URL"; - _description = "Overwrites the local *.data files with those found at the URL."; + _description = STRING_CMD_PULL_USAGE; _read_only = true; _displays_id = false; } @@ -61,7 +64,7 @@ int CmdPull::execute (std::string& output) Directory location (context.config.get ("data.location")); if (! uri.append ("{pending,undo,completed}.data")) - throw std::string ("The uri '") + uri._path + "' is not a directory. Did you forget a trailing '/'?"; + throw format (STRING_CMD_PULL_NOT_DIR, uri._path); Transport* transport; if ((transport = Transport::getTransport (uri)) != NULL) @@ -74,7 +77,7 @@ int CmdPull::execute (std::string& output) // Verify that files are not being copied from rc.data.location to the // same place. if (Directory (uri._path) == Directory (context.config.get ("data.location"))) - throw std::string ("Cannot pull files when the source and destination are the same."); + throw std::string (STRING_CMD_PULL_SAME); // copy files locally @@ -104,16 +107,14 @@ int CmdPull::execute (std::string& output) } else { - throw std::string ("At least one of the database files in '" + uri._path + "' is not present."); + throw format (STRING_CMD_PULL_MISSING, uri._path); } } - output += "Tasks transferred from " + uri._data + "\n"; + output += format (STRING_CMD_PULL_TRANSFERRED, uri._data) + "\n"; } else - throw std::string ("No uri was specified for the pull. Either specify " - "the uri of a remote .task directory, or create a " - "'pull.default.uri' entry in your .taskrc file."); + throw std::string (STRING_CMD_PULL_NO_URI); return 0; } diff --git a/src/commands/CmdPush.cpp b/src/commands/CmdPush.cpp index 568dbe353..820081fe7 100644 --- a/src/commands/CmdPush.cpp +++ b/src/commands/CmdPush.cpp @@ -25,11 +25,14 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include #include #include #include +#include #include #include @@ -40,14 +43,14 @@ CmdPush::CmdPush () { _keyword = "push"; _usage = "task push URL"; - _description = "Pushes the local *.data files to the URL."; + _description = STRING_CMD_PUSH_USAGE; _read_only = true; _displays_id = false; } //////////////////////////////////////////////////////////////////////////////// -// Transfers the local data (from rc.location._data) to the remote path. Because -// this is potentially on another machine, no checking can be performed. +// Transfers the local data (from rc.location._data) to the remote path. +// Because this is potentially on another machine, no checking can be performed. int CmdPush::execute (std::string& output) { std::vector words = context.a3.extract_words (); @@ -73,11 +76,11 @@ int CmdPush::execute (std::string& output) // Verify that files are not being copied from rc.data.location to the // same place. if (Directory (uri._path) == Directory (context.config.get ("data.location"))) - throw std::string ("Cannot push files when the source and destination are the same."); + throw std::string (STRING_CMD_PUSH_SAME); // copy files locally if (! Path (uri._data).is_directory ()) - throw std::string ("The uri '") + uri._path + "' is not a local directory."; + throw format (STRING_CMD_PUSH_NONLOCAL, uri._path); std::ifstream ifile1 ((location._data + "/undo.data").c_str(), std::ios_base::binary); std::ofstream ofile1 ((uri._path + "/undo.data").c_str(), std::ios_base::binary); @@ -92,12 +95,10 @@ int CmdPush::execute (std::string& output) ofile3 << ifile3.rdbuf(); } - output += "Local tasks transferred to " + uri._data + "\n"; + output += format (STRING_CMD_PUSH_TRANSFERRED, uri._data) + "\n"; } else - throw std::string ("No uri was specified for the push. Either specify " - "the uri of a remote .task directory, or create a " - "'push.default.uri' entry in your .taskrc file."); + throw std::string (STRING_CMD_PUSH_NO_URI); return 0; } diff --git a/src/commands/CmdSynch.cpp b/src/commands/CmdSynch.cpp index 0814b8f3f..751ae2ea9 100644 --- a/src/commands/CmdSynch.cpp +++ b/src/commands/CmdSynch.cpp @@ -25,8 +25,12 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include +#include +#include #include extern Context context; @@ -36,7 +40,7 @@ CmdSynch::CmdSynch () { _keyword = "synchronize"; _usage = "task synchronize"; - _description = "(Not implemented for 2.0.0beta1)"; + _description = STRING_CMD_SYNCH_USAGE; _read_only = false; _displays_id = true; } @@ -44,6 +48,7 @@ CmdSynch::CmdSynch () //////////////////////////////////////////////////////////////////////////////// int CmdSynch::execute (std::string& output) { + // TODO Tempporary. std::cout << "\n" << "Task Server Synchronization is not implemented in 2.0.0beta1.\n" << "\n"; diff --git a/src/en-US.h b/src/en-US.h index 75f40cc8f..cbe3ced03 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -312,6 +312,29 @@ #define STRING_CMD_IMPORT_USAGE "Imports JSON files" #define STRING_CMD_IMPORT_SUMMARY "Imported {1} tasks." #define STRING_CMD_SHELL_USAGE "Launches an interactive shell" +#define STRING_CMD_SYNCH_USAGE "(Not implemented for 2.0.0beta2)" +#define STRING_CMD_DIAG_USAGE "Shows information needed when reporting a problem." +#define STRING_CMD_DIAG_PLATFORM "Platform" +#define STRING_CMD_DIAG_UNKNOWN "" +#define STRING_CMD_DIAG_COMPILER "Compiler" +#define STRING_CMD_DIAG_VERSION "Version" +#define STRING_CMD_DIAG_CAPS "Caps" +#define STRING_CMD_DIAG_LIBRARIES "Libraries" +#define STRING_CMD_DIAG_FEATURES "Build Features" +#define STRING_CMD_DIAG_BUILT "Built" +#define STRING_CMD_DIAG_COMMIT "Commit" +#define STRING_CMD_PUSH_USAGE "Pushes the local *.data files to the URL." +#define STRING_CMD_PUSH_SAME "Cannot push files when the source and destination are the same." +#define STRING_CMD_PUSH_NONLOCAL "The uri '{1}' is not a local directory." +#define STRING_CMD_PUSH_TRANSFERRED "Local tasks transferred to {1}" +#define STRING_CMD_PUSH_NO_URI "No uri was specified for the push. Either specify the uri of a remote .task directory, or create a 'push.default.uri' entry in your .taskrc file." + +#define STRING_CMD_PULL_USAGE "Overwrites the local *.data files with those found at the URL." +#define STRING_CMD_PULL_SAME "Cannot pull files when the source and destination are the same." +#define STRING_CMD_PULL_TRANSFERRED "Local tasks transferred from {1}" +#define STRING_CMD_PULL_NO_URI "No uri was specified for the pull. Either specify the uri of a remote .task directory, or create a 'pull.default.uri' entry in your .taskrc file." +#define STRING_CMD_PULL_MISSING "At least one of the database files in '{1}' is not present." +#define STRING_CMD_PULL_NOT_DIR "The uri '{1}' is not a directory. Did you forget a trailing '/'?" // Config #define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."