mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
I18N
- Localized more commands.
This commit is contained in:
parent
63203cd91a
commit
31aa0de426
5 changed files with 62 additions and 29 deletions
|
@ -31,6 +31,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <RX.h>
|
||||
#include <Context.h>
|
||||
#include <i18n.h>
|
||||
#include <text.h>
|
||||
#include <util.h>
|
||||
#include <cmake.h>
|
||||
#include <commit.h>
|
||||
|
@ -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
|
||||
"<unknown>"
|
||||
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
|
||||
|
|
|
@ -25,11 +25,14 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <Context.h>
|
||||
#include <Uri.h>
|
||||
#include <Transport.h>
|
||||
#include <i18n.h>
|
||||
#include <text.h>
|
||||
#include <CmdPull.h>
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -25,11 +25,14 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <Context.h>
|
||||
#include <Uri.h>
|
||||
#include <Transport.h>
|
||||
#include <i18n.h>
|
||||
#include <text.h>
|
||||
#include <CmdPush.h>
|
||||
|
||||
|
@ -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 <std::string> 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;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,12 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <iostream>
|
||||
#include <Context.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
#include <CmdSynch.h>
|
||||
|
||||
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";
|
||||
|
|
23
src/en-US.h
23
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 "<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."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue