- Localized 'merge' command.
This commit is contained in:
Paul Beckingham 2011-10-01 13:16:59 -04:00
parent 81ca87b7da
commit 164a6b97ce
2 changed files with 12 additions and 8 deletions

View file

@ -25,11 +25,14 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <Context.h> #include <Context.h>
#include <Uri.h> #include <Uri.h>
#include <Transport.h> #include <Transport.h>
#include <i18n.h>
#include <text.h> #include <text.h>
#include <util.h> #include <util.h>
#include <CmdMerge.h> #include <CmdMerge.h>
@ -41,7 +44,7 @@ CmdMerge::CmdMerge ()
{ {
_keyword = "merge"; _keyword = "merge";
_usage = "task merge URL"; _usage = "task merge URL";
_description = "Merges the specified undo.data file with the local data files."; _description = STRING_CMD_MERGE_USAGE;
_read_only = false; _read_only = false;
_displays_id = false; _displays_id = false;
} }
@ -88,13 +91,13 @@ int CmdMerge::execute (std::string& output)
context.tdb2.merge (file); context.tdb2.merge (file);
output += "Merge complete.\n"; output += std::string (STRING_CMD_MERGE_COMPLETE) + "\n";
if (tmpfile != "") if (tmpfile != "")
remove (tmpfile.c_str ()); remove (tmpfile.c_str ());
if ( ((sAutopush == "ask") && (confirm ("Would you like to push the merged changes to \'" + uri._data + "\'?")) ) if (((sAutopush == "ask") && (confirm (format (STRING_CMD_MERGE_CONFIRM, uri._data))))
|| (bAutopush) ) || (bAutopush))
{ {
// Derive autopush uri from merge.default.uri? otherwise: change prompt above // Derive autopush uri from merge.default.uri? otherwise: change prompt above
@ -117,9 +120,7 @@ int CmdMerge::execute (std::string& output)
} }
} }
else else
throw std::string ("No uri was specified for the merge. Either specify " throw std::string (STRING_CMD_MERGE_NO_URI);
"the uri of a remote .task directory, or create a "
"'merge.default.uri' entry in your .taskrc file.");
return 0; return 0;
} }

View file

@ -355,7 +355,6 @@
#define STRING_CMD_DIAG_UUID_GOOD "1000 unique UUIDs generated." #define STRING_CMD_DIAG_UUID_GOOD "1000 unique UUIDs generated."
#define STRING_CMD_DIAG_UUID_BAD "Failed - duplicate UUID at iteration {1}" #define STRING_CMD_DIAG_UUID_BAD "Failed - duplicate UUID at iteration {1}"
#define STRING_CMD_DIAG_NONE "-none-" #define STRING_CMD_DIAG_NONE "-none-"
#define STRING_CMD_PUSH_USAGE "Pushes the local *.data files to the URL." #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_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_NONLOCAL "The uri '{1}' is not a local directory."
@ -414,6 +413,10 @@
#define STRING_CMD_TIMESHEET_USAGE "Shows a weekly report of tasks completed and started." #define STRING_CMD_TIMESHEET_USAGE "Shows a weekly report of tasks completed and started."
#define STRING_CMD_TIMESHEET_STARTED "Started ({1} tasks)" #define STRING_CMD_TIMESHEET_STARTED "Started ({1} tasks)"
#define STRING_CMD_TIMESHEET_DONE "Completed ({1} tasks)" #define STRING_CMD_TIMESHEET_DONE "Completed ({1} tasks)"
#define STRING_CMD_MERGE_USAGE "Merges the specified undo.data file with the local data files."
#define STRING_CMD_MERGE_COMPLETE "Merge complete."
#define STRING_CMD_MERGE_CONFIRM "Would you like to push the merged changes to '{1}'?"
#define STRING_CMD_MERGE_NO_URI "No uri was specified for the merge. Either specify the uri of a remote .task directory, or create a 'merge.default.uri' entry in your .taskrc file."
// 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."