From a544431ed7ab689b562d2ec4edd14c5b70fb508e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 26 Sep 2011 21:14:11 -0400 Subject: [PATCH] I18N - Localized 'import' command. --- src/commands/CmdImport.cpp | 10 ++++++---- src/en-US.h | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/commands/CmdImport.cpp b/src/commands/CmdImport.cpp index fc76c5f67..5e1a7ad3f 100644 --- a/src/commands/CmdImport.cpp +++ b/src/commands/CmdImport.cpp @@ -25,6 +25,8 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include #include @@ -57,13 +59,13 @@ int CmdImport::execute (std::string& output) // Use the description as a file name. std::vector 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 ::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; } diff --git a/src/en-US.h b/src/en-US.h index 3ae67d39c..7b3385648 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -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."