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
393ebae8aa
commit
b63835757f
12 changed files with 81 additions and 37 deletions
|
@ -24,6 +24,9 @@
|
|||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
@ -150,7 +153,7 @@ Color::Color (const std::string& spec)
|
|||
{
|
||||
index = atoi (word.substr (4).c_str ());
|
||||
if (index < 0 || index > 23)
|
||||
throw std::string ("The color '") + *it + "' is not recognized.";
|
||||
throw format (STRING_COLOR_UNRECOGNIZED, *it);
|
||||
|
||||
if (bg)
|
||||
{
|
||||
|
@ -172,7 +175,7 @@ Color::Color (const std::string& spec)
|
|||
index = atoi (word.substr (3).c_str ());
|
||||
if (word.length () != 6 ||
|
||||
index < 0 || index > 555)
|
||||
throw std::string ("The color '") + *it + "' is not recognized.";
|
||||
throw format (STRING_COLOR_UNRECOGNIZED, *it);
|
||||
|
||||
int r = atoi (word.substr (3, 1).c_str ());
|
||||
int g = atoi (word.substr (4, 1).c_str ());
|
||||
|
@ -180,7 +183,7 @@ Color::Color (const std::string& spec)
|
|||
if (r < 0 || r > 5 ||
|
||||
g < 0 || g > 5 ||
|
||||
b < 0 || b > 5)
|
||||
throw std::string ("The color '") + *it + "' is not recognized.";
|
||||
throw format (STRING_COLOR_UNRECOGNIZED, *it);
|
||||
|
||||
index = 16 + r*36 + g*6 + b;
|
||||
|
||||
|
@ -203,7 +206,7 @@ Color::Color (const std::string& spec)
|
|||
{
|
||||
index = atoi (word.substr (5).c_str ());
|
||||
if (index < 0 || index > 255)
|
||||
throw std::string ("The color '") + *it + "' is not recognized.";
|
||||
throw format (STRING_COLOR_UNRECOGNIZED, *it);
|
||||
|
||||
upgrade ();
|
||||
|
||||
|
@ -221,7 +224,7 @@ Color::Color (const std::string& spec)
|
|||
}
|
||||
}
|
||||
else if (word != "")
|
||||
throw std::string ("The color '") + *it + "' is not recognized.";
|
||||
throw format (STRING_COLOR_UNRECOGNIZED, *it);
|
||||
}
|
||||
|
||||
// Now combine the fg and bg into a single color.
|
||||
|
|
|
@ -29,8 +29,11 @@
|
|||
#include <Permission.h>
|
||||
#include <Context.h>
|
||||
#include <util.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -56,16 +59,14 @@ bool Permission::confirmed (const Task& task, const std::string& question)
|
|||
if (allConfirmed)
|
||||
return true;
|
||||
|
||||
std::cout << "\nTask "
|
||||
<< task.id
|
||||
<< " \""
|
||||
<< task.get ("description")
|
||||
<< "\"";
|
||||
std::cout << "\n"
|
||||
<< format (STRING_PERM_TASK_LINE, task.id, task.get ("description"));
|
||||
|
||||
if (task.getStatus () == Task::recurring ||
|
||||
task.has ("parent"))
|
||||
{
|
||||
std::cout << " (Recurring)";
|
||||
std::cout << " "
|
||||
<< STRING_PERM_RECURRING;
|
||||
}
|
||||
|
||||
std::cout << std::endl; // Flush.
|
||||
|
|
|
@ -25,8 +25,11 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <i18n.h>
|
||||
#include <assert.h>
|
||||
#include <Taskmod.h>
|
||||
|
||||
|
@ -130,9 +133,7 @@ bool Taskmod::isValid ()
|
|||
std::string Taskmod::getUuid ()
|
||||
{
|
||||
if (!bAfterSet)
|
||||
{
|
||||
throw std::string ("Taskmod::getUuid(): Task object not initialized.");
|
||||
}
|
||||
throw std::string (STRING_TASKMOD_BAD_INIT);
|
||||
|
||||
return after.get ("uuid");
|
||||
}
|
||||
|
@ -143,14 +144,14 @@ std::string Taskmod::toString ()
|
|||
assert (bAfterSet);
|
||||
|
||||
std::stringstream stream;
|
||||
stream << "time " << timestamp << "\n";
|
||||
stream << STRING_TASKMOD_TIME << timestamp << "\n";
|
||||
|
||||
if (bBeforeSet)
|
||||
{
|
||||
stream << "old " << before.composeF4();
|
||||
stream << STRING_TASKMOD_OLD << before.composeF4();
|
||||
}
|
||||
|
||||
stream << "new " << after.composeF4();
|
||||
stream << STRING_TASKMOD_NEW << after.composeF4();
|
||||
stream << "---\n";
|
||||
|
||||
return stream.str ();
|
||||
|
@ -202,3 +203,5 @@ std::string Taskmod::getTimeStr () const
|
|||
|
||||
return sstream.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <util.h>
|
||||
|
|
|
@ -25,7 +25,11 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <Context.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
#include <Uri.h>
|
||||
|
||||
extern Context context;
|
||||
|
@ -231,7 +235,7 @@ void Uri::parse ()
|
|||
}
|
||||
else
|
||||
{
|
||||
throw std::string ("Could not parse uri '") + data + "', wrong usage of single quotes.";
|
||||
throw std::string (format (STRING_URI_QUOTES, data));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -252,7 +256,7 @@ void Uri::parse ()
|
|||
}
|
||||
else
|
||||
{
|
||||
throw std::string ("The uri '") + data + "' is not in the expected format.";
|
||||
throw std::string (format (STRING_URI_BAD_FORMAT, data));
|
||||
}
|
||||
|
||||
// path is absolute for ssh:// syntax
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <ViewTask.h>
|
||||
#include <Context.h>
|
||||
#include <Timer.h>
|
||||
|
@ -104,8 +106,6 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||
// Determine minimal, ideal column widths.
|
||||
std::vector <int> minimal;
|
||||
std::vector <int> ideal;
|
||||
// std::vector <int> avg_ideal;
|
||||
// int cumulative_ideal = 0;
|
||||
|
||||
std::vector <Column*>::iterator i;
|
||||
for (i = _columns.begin (); i != _columns.end (); ++i)
|
||||
|
@ -129,17 +129,10 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||
|
||||
if (min > global_min) global_min = min;
|
||||
if (ideal > global_ideal) global_ideal = ideal;
|
||||
|
||||
// cumulative_ideal += ideal;
|
||||
}
|
||||
|
||||
minimal.push_back (global_min);
|
||||
ideal.push_back (global_ideal);
|
||||
|
||||
// if (data.size ())
|
||||
// avg_ideal.push_back ((int) (cumulative_ideal / data.size ()));
|
||||
// else
|
||||
// avg_ideal.push_back (0);
|
||||
}
|
||||
|
||||
// Sum the minimal widths.
|
||||
|
@ -163,7 +156,6 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||
if (_width == 0 || sum_ideal <= overage)
|
||||
widths = ideal;
|
||||
else if (sum_minimal > overage || overage < 0)
|
||||
// throw std::string ("There is not enough horizontal width to display the results.");
|
||||
widths = minimal;
|
||||
else if (overage > 0)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <ViewText.h>
|
||||
#include <Context.h>
|
||||
#include <Timer.h>
|
||||
|
@ -152,7 +154,6 @@ std::string ViewText::render ()
|
|||
if (sum_ideal <= overage)
|
||||
widths = ideal;
|
||||
else if (sum_minimal > overage || overage < 0)
|
||||
// throw std::string ("There is not enough horizontal width to display the results.");
|
||||
widths = minimal;
|
||||
else if (overage > 0)
|
||||
{
|
||||
|
|
|
@ -25,8 +25,11 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <Context.h>
|
||||
#include <i18n.h>
|
||||
#include <CmdExec.h>
|
||||
|
||||
extern Context context;
|
||||
|
@ -36,7 +39,7 @@ CmdExec::CmdExec ()
|
|||
{
|
||||
_keyword = "execute";
|
||||
_usage = "task execute <external command>";
|
||||
_description = "Executes external commands and scripts";
|
||||
_description = STRING_CMD_EXEC_USAGE;
|
||||
_read_only = false;
|
||||
_displays_id = true;
|
||||
}
|
||||
|
|
|
@ -25,10 +25,14 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define L10N // Localization complete.
|
||||
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <Context.h>
|
||||
#include <main.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
#include <CmdUrgency.h>
|
||||
|
||||
extern Context context;
|
||||
|
@ -38,7 +42,7 @@ CmdUrgency::CmdUrgency ()
|
|||
{
|
||||
_keyword = "_urgency";
|
||||
_usage = "task _urgency <IDs>";
|
||||
_description = "Displays the urgency measure of a task.";
|
||||
_description = STRING_CMD_URGENCY_USAGE;
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
@ -60,7 +64,7 @@ int CmdUrgency::execute (std::string& output)
|
|||
|
||||
if (filtered.size () == 0)
|
||||
{
|
||||
context.footnote ("No tasks specified.");
|
||||
context.footnote (STRING_CMD_URGENCY_NO_TASKS);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -68,10 +72,7 @@ int CmdUrgency::execute (std::string& output)
|
|||
std::stringstream out;
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
out << "task "
|
||||
<< task->id
|
||||
<< " urgency "
|
||||
<< task->urgency ()
|
||||
out << format (STRING_CMD_URGENCY_RESULT, task->id, task->urgency ())
|
||||
<< "\n";
|
||||
|
||||
output = out.str ();
|
||||
|
|
21
src/en-US.h
21
src/en-US.h
|
@ -102,6 +102,9 @@
|
|||
#define STRING_API_WARNING "Warning: {1}"
|
||||
#define STRING_API_ERROR "Error: {1}"
|
||||
|
||||
// Color
|
||||
#define STRING_COLOR_UNRECOGNIZED "The color '{1}' is not recognized."
|
||||
|
||||
// columns/Col*
|
||||
#define STRING_COLUMN_BAD_NAME "Unrecognized column name '{1}'"
|
||||
#define STRING_COLUMN_BAD_FORMAT "Unrecognized column format '{1}.{2}'"
|
||||
|
@ -150,6 +153,10 @@
|
|||
#define STRING_CMD_VERSION_COPY2 "Portions of this software Copyright (C) 1994 – 2008 Lua.org, PUC-Rio."
|
||||
#define STRING_CMD_LOGO_USAGE "Displays the Taskwarrior logo"
|
||||
#define STRING_CMD_LOGO_COLOR_REQ "The logo command requires that color support is enabled."
|
||||
#define STRING_CMD_EXEC_USAGE "Executes external commands and scripts"
|
||||
#define STRING_CMD_URGENCY_USAGE "Displays the urgency measure of a task."
|
||||
#define STRING_CMD_URGENCY_NO_TASKS "No tasks specified."
|
||||
#define STRING_CMD_URGENCY_RESULT "task {1} urgency {2}"
|
||||
|
||||
// Config
|
||||
#define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."
|
||||
|
@ -182,6 +189,10 @@
|
|||
#define STRING_LUA_BAD_HOOK_DEF "Malformed hook definition '{1}'."
|
||||
#define STRING_LUA_BAD_EVENT "Unrecognized hook event '{1}'."
|
||||
|
||||
// Permission
|
||||
#define STRING_PERM_TASK_LINE "task {1} \"{2}\""
|
||||
#define STRING_PERM_RECURRING "(Recurring)"
|
||||
|
||||
// Record
|
||||
#define STRING_RECORD_EMPTY "Empty record in input."
|
||||
#define STRING_RECORD_JUNK_AT_EOL "Unrecognized characters at end of line."
|
||||
|
@ -202,10 +213,20 @@
|
|||
#define STRING_CMD_SHOW_CONF_VAR "Config Variable"
|
||||
#define STRING_CMD_SHOW_CONF_VALUE "Value"
|
||||
|
||||
// Taskmod
|
||||
#define STRING_TASKMOD_BAD_INIT "Taskmod::getUuid(): Task object not initialized."
|
||||
#define STRING_TASKMOD_TIME "time "
|
||||
#define STRING_TASKMOD_OLD "old "
|
||||
#define STRING_TASKMOD_NEW "new "
|
||||
|
||||
// text
|
||||
// A comma-separated list of commands is appended.
|
||||
#define STRING_TEXT_AMBIGUOUS "Ambiguous {1} '{2}' - could be either of "
|
||||
|
||||
// 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."
|
||||
|
||||
// utf8
|
||||
#define STRING_UTF8_INVALID_CP_REP "Invalid codepoint representation."
|
||||
#define STRING_UTF8_INVALID_CP "Invalid Unicode codepoint."
|
||||
|
|
12
src/text.cpp
12
src/text.cpp
|
@ -890,6 +890,18 @@ const std::string format (
|
|||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::string format (
|
||||
const std::string& fmt,
|
||||
int arg1,
|
||||
double arg2)
|
||||
{
|
||||
std::string output = fmt;
|
||||
replace_positional (output, "{1}", format (arg1));
|
||||
replace_positional (output, "{2}", format (arg2, 6, 3));
|
||||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::string format (
|
||||
const std::string& fmt,
|
||||
|
|
|
@ -78,6 +78,7 @@ const std::string format (const std::string&, const std::string&, const std::str
|
|||
const std::string format (const std::string&, const std::string&, int);
|
||||
const std::string format (const std::string&, int, const std::string&);
|
||||
const std::string format (const std::string&, int, int);
|
||||
const std::string format (const std::string&, int, double);
|
||||
const std::string format (const std::string&, const std::string&, const std::string&, const std::string&);
|
||||
|
||||
std::string leftJustify (const int, const int);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue