mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
I18N
- Localized more files.
This commit is contained in:
parent
3b2e93f1a0
commit
a9a4c1c692
4 changed files with 45 additions and 22 deletions
|
@ -25,8 +25,11 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <TransportCurl.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
#include <util.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -39,7 +42,7 @@ TransportCurl::TransportCurl(const Uri& uri) : Transport(uri)
|
|||
void TransportCurl::send(const std::string& source)
|
||||
{
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'curl' protocol, the uri must contain a hostname.");
|
||||
throw std::string (STRING_TRANSPORT_CURL_URI);
|
||||
|
||||
if (uri.user != "")
|
||||
{
|
||||
|
@ -53,10 +56,10 @@ void TransportCurl::send(const std::string& source)
|
|||
pos = source.find("{");
|
||||
|
||||
if (pos == std::string::npos)
|
||||
throw std::string ("When using the 'curl' protocol, wildcards are not supported.");
|
||||
throw std::string (STRING_TRANSPORT_CURL_WILDCD);
|
||||
|
||||
if (!uri.is_directory())
|
||||
throw std::string ("The uri '") + uri.path + "' does not appear to be a directory.";
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, uri.path);
|
||||
|
||||
arguments.push_back ("-T");
|
||||
arguments.push_back ("\"" + source + "\"");
|
||||
|
@ -81,9 +84,9 @@ void TransportCurl::send(const std::string& source)
|
|||
if (result)
|
||||
{
|
||||
if (result == 127) // command not found
|
||||
throw std::string ("Could not run curl. Is it installed, and available in $PATH?");
|
||||
throw std::string (STRING_TRANSPORT_CURL_NORUN);
|
||||
else
|
||||
throw std::string ("Curl failed, see output above.");
|
||||
throw std::string (STRING_TRANSPORT_CURL_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +94,7 @@ void TransportCurl::send(const std::string& source)
|
|||
void TransportCurl::recv(std::string target)
|
||||
{
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'curl' protocol, the uri must contain a hostname.");
|
||||
throw std::string (STRING_TRANSPORT_CURL_URI);
|
||||
|
||||
if (uri.user != "")
|
||||
{
|
||||
|
@ -106,10 +109,10 @@ void TransportCurl::recv(std::string target)
|
|||
pos = uri.path.find("{");
|
||||
|
||||
if (pos == std::string::npos)
|
||||
throw std::string ("When using the 'curl' protocol, wildcards are not supported.");
|
||||
throw std::string (STRING_TRANSPORT_CURL_WILDCD);
|
||||
|
||||
if (!is_directory(target))
|
||||
throw std::string ("The uri '") + target + "' does not appear to be a directory.";
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, target);
|
||||
|
||||
std::string toSplit;
|
||||
std::string suffix;
|
||||
|
@ -147,9 +150,9 @@ void TransportCurl::recv(std::string target)
|
|||
if (result)
|
||||
{
|
||||
if (result == 127) // command not found
|
||||
throw std::string ("Could not run curl. Is it installed, and available in $PATH?");
|
||||
throw std::string (STRING_TRANSPORT_CURL_NORUN);
|
||||
else
|
||||
throw std::string ("Curl failed, see output above.");
|
||||
throw std::string (STRING_TRANSPORT_CURL_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
#include <TransportRSYNC.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -37,12 +41,12 @@ TransportRSYNC::TransportRSYNC(const Uri& uri) : Transport(uri)
|
|||
void TransportRSYNC::send(const std::string& source)
|
||||
{
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'rsync' protocol, the uri must contain a hostname.");
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_URI);
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then path has to end with a '/'
|
||||
if (is_filelist(source) && !uri.is_directory())
|
||||
throw std::string ("The uri '") + uri.path + "' does not appear to be a directory.";
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, uri.path);
|
||||
|
||||
// cmd line is: rsync [--port=PORT] source [user@]host::path
|
||||
if (uri.port != "")
|
||||
|
@ -62,19 +66,19 @@ void TransportRSYNC::send(const std::string& source)
|
|||
}
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Could not run rsync. Is it installed, and available in $PATH?");
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_NORUN);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportRSYNC::recv(std::string target)
|
||||
{
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'rsync' protocol, the uri must contain a hostname.");
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_URI);
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then target has to end with a '/'
|
||||
if (is_filelist(uri.path) && !is_directory(target))
|
||||
throw std::string ("The uri '") + target + "' does not appear to be a directory.";
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, target);
|
||||
|
||||
// cmd line is: rsync [--port=PORT] [user@]host::path target
|
||||
if (uri.port != "")
|
||||
|
@ -92,7 +96,7 @@ void TransportRSYNC::recv(std::string target)
|
|||
arguments.push_back (target);
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Could not run rsync. Is it installed, and available in $PATH?");
|
||||
throw std::string (STRING_TRANSPORT_RSYNC_NORUN);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
#include <TransportSSH.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -37,12 +41,12 @@ TransportSSH::TransportSSH(const Uri& uri) : Transport(uri)
|
|||
void TransportSSH::send(const std::string& source)
|
||||
{
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'ssh' protocol, the uri must contain a hostname.");
|
||||
throw std::string (STRING_TRANSPORT_SSH_URI);
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then path has to end with a '/'
|
||||
if (is_filelist(source) && !uri.is_directory())
|
||||
throw std::string ("The uri '") + uri.path + "' does not appear to be a directory.";
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, uri.path);
|
||||
|
||||
// cmd line is: scp [-p port] [user@]host:path
|
||||
if (uri.port != "")
|
||||
|
@ -63,19 +67,19 @@ void TransportSSH::send(const std::string& source)
|
|||
}
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Could not run scp. Is it installed, and available in $PATH?");
|
||||
throw std::string (STRING_TRANSPORT_SSH_NORUN);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportSSH::recv(std::string target)
|
||||
{
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'ssh' protocol, the uri must contain a hostname.");
|
||||
throw std::string (STRING_TRANSPORT_SSH_URI);
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then target has to end with a '/'
|
||||
if (is_filelist(uri.path) && !is_directory(target))
|
||||
throw std::string ("The uri '") + target + "' does not appear to be a directory.";
|
||||
throw format (STRING_TRANSPORT_URI_NODIR, target);
|
||||
|
||||
// cmd line is: scp [-p port] [user@]host:path
|
||||
if (uri.port != "")
|
||||
|
@ -96,7 +100,7 @@ void TransportSSH::recv(std::string target)
|
|||
arguments.push_back (target);
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Could not run scp. Is it installed, and available in $PATH?");
|
||||
throw std::string (STRING_TRANSPORT_SSH_NORUN);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
12
src/en-US.h
12
src/en-US.h
|
@ -352,6 +352,18 @@
|
|||
// A comma-separated list of commands is appended.
|
||||
#define STRING_TEXT_AMBIGUOUS "Ambiguous {1} '{2}' - could be either of "
|
||||
|
||||
// Transport
|
||||
#define STRING_TRANSPORT_URI_NODIR "The uri '{1}' does not appear to be a directory."
|
||||
#define STRING_TRANSPORT_CURL_URI "When using the 'curl' protocol, the uri must contain a hostname."
|
||||
#define STRING_TRANSPORT_CURL_WILDCD "When using the 'curl' protocol, wildcards are not supported."
|
||||
#define STRING_TRANSPORT_CURL_NORUN "Could not run curl. Is it installed, and available in $PATH?"
|
||||
#define STRING_TRANSPORT_CURL_FAIL "Curl failed, see output above."
|
||||
#define STRING_TRANSPORT_RSYNC_URI "When using the 'rsync' protocol, the uri must contain a hostname."
|
||||
#define STRING_TRANSPORT_RSYNC_NORUN "Could not run rsync. Is it installed, and available in $PATH?"
|
||||
#define STRING_TRANSPORT_SSH_URI "When using the 'ssh' protocol, the uri must contain a hostname."
|
||||
#define STRING_TRANSPORT_SSH_NORUN "Could not run ssh. Is it installed, and available in $PATH?"
|
||||
|
||||
|
||||
// Uri
|
||||
#define STRING_URI_QUOTES "Could not parse uri '{1}', wrong usage of single quotes."
|
||||
#define STRING_URI_BAD_FORMAT "The uri '{1}' is not in the expected format."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue