- Localized 'import' command.
This commit is contained in:
Paul Beckingham 2011-09-26 21:14:11 -04:00
parent 24c3b45b46
commit a544431ed7
2 changed files with 10 additions and 4 deletions

View file

@ -25,6 +25,8 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <iostream>
#include <sstream>
#include <Context.h>
@ -57,13 +59,13 @@ int CmdImport::execute (std::string& output)
// Use the description as a file name.
std::vector <std::string> words = context.a3.extract_words ();
if (! words.size ())
throw std::string ("You must specify a file to import.");
throw std::string (STRING_CMD_IMPORT_NOFILE);
std::vector <std::string>::iterator word;
for (word = words.begin (); word != words.end (); ++word)
{
std::string file = *word;
std::cout << "Importing '" << file << "'\n";
std::cout << format (STRING_CMD_IMPORT_FILE, file) << "\n";
std::string tmpfile = "";
Uri uri (file);
@ -183,7 +185,7 @@ int CmdImport::execute (std::string& output)
}
else
throw std::string ("Unrecognized attribute '") + i->first + "'";
throw format (STRING_CMD_IMPORT_BAD_ATT, i->first);
}
}
@ -196,7 +198,7 @@ int CmdImport::execute (std::string& output)
<< "\n";
}
else
throw std::string ("Not a JSON object: ") + *line;
throw format (STRING_CMD_IMPORT_NOT_JSON, *line);
delete root;
}

View file

@ -311,6 +311,10 @@
#define STRING_CMD_DENO_NOMATCH "Did not find any matching annotation to be deleted for '{1}'."
#define STRING_CMD_IMPORT_USAGE "Imports JSON files"
#define STRING_CMD_IMPORT_SUMMARY "Imported {1} tasks."
#define STRING_CMD_IMPORT_NOFILE "You must specify a file to import."
#define STRING_CMD_IMPORT_FILE "Importing '{1}'"
#define STRING_CMD_IMPORT_BAD_ATT "Unrecognized attribute '{1}'"
#define STRING_CMD_IMPORT_NOT_JSON "Not a JSON object: {1}"
#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."