mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
I18N
- Localized feedback.cpp, helpers.cpp. One more source file left!
This commit is contained in:
parent
ab575372d7
commit
375faf8cd8
3 changed files with 75 additions and 70 deletions
21
src/en-US.h
21
src/en-US.h
|
@ -596,10 +596,31 @@
|
||||||
#define STRING_FEEDBACK_NO_MATCH "No matches."
|
#define STRING_FEEDBACK_NO_MATCH "No matches."
|
||||||
#define STRING_FEEDBACK_TASKS_SINGLE "(1 task)"
|
#define STRING_FEEDBACK_TASKS_SINGLE "(1 task)"
|
||||||
#define STRING_FEEDBACK_TASKS_PLURAL "({1} tasks)"
|
#define STRING_FEEDBACK_TASKS_PLURAL "({1} tasks)"
|
||||||
|
#define STRING_FEEDBACK_DELETED "{1} will be deleted."
|
||||||
|
#define STRING_FEEDBACK_DEP_SET "Dependencies will be set to '{1}'."
|
||||||
|
#define STRING_FEEDBACK_DEP_MOD "Dependencies will be changed from '{1}' to '{2}'."
|
||||||
|
#define STRING_FEEDBACK_DEP_DEL "Dependencies '{1}' deleted."
|
||||||
|
#define STRING_FEEDBACK_DEP_WAS_SET "Dependencies set to '{1}'."
|
||||||
|
#define STRING_FEEDBACK_DEP_WAS_MOD "Dependencies changed from '{1}' to '{2}'."
|
||||||
|
#define STRING_FEEDBACK_ATT_SET "{1} will be set to '{2}'."
|
||||||
|
#define STRING_FEEDBACK_ATT_MOD "{1} will be changed from '{2}' to '{3}'."
|
||||||
|
#define STRING_FEEDBACK_ATT_DEL "{1} deleted."
|
||||||
|
#define STRING_FEEDBACK_ATT_WAS_SET "{1} set to '{2}'."
|
||||||
|
#define STRING_FEEDBACK_ATT_WAS_MOD "{1} changed from '{2}' to '{3}'."
|
||||||
|
#define STRING_FEEDBACK_ANN_ADD "Annotation of '{1}' added."
|
||||||
|
#define STRING_FEEDBACK_ANN_DEL "Annotation '{1} deleted."
|
||||||
|
#define STRING_FEEDBACK_ANN_WAS_MOD "Annotation changed to '{1}'."
|
||||||
|
#define STRING_FEEDBACK_NOP "No changes will be made."
|
||||||
|
#define STRING_FEEDBACK_WAS_NOP "No changes made."
|
||||||
|
|
||||||
// File
|
// File
|
||||||
#define STRING_FILE_PERMS "Task does not have the correct permissions for '{1}'."
|
#define STRING_FILE_PERMS "Task does not have the correct permissions for '{1}'."
|
||||||
|
|
||||||
|
// helpers
|
||||||
|
#define STRING_HELPER_PROJECT_CHANGE "The project '{1}' has changed."
|
||||||
|
#define STRING_HELPER_PROJECT_COMPL "Project '{1}' is {2}% complete"
|
||||||
|
#define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)."
|
||||||
|
|
||||||
// interactive
|
// interactive
|
||||||
#define STRING_INTERACTIVE_WIDTH "Context::getWidth: determined width of {1} characters"
|
#define STRING_INTERACTIVE_WIDTH "Context::getWidth: determined width of {1} characters"
|
||||||
#define STRING_INTERACTIVE_HEIGHT "Context::getHeight: determined height of {1} characters"
|
#define STRING_INTERACTIVE_HEIGHT "Context::getHeight: determined height of {1} characters"
|
||||||
|
|
104
src/feedback.cpp
104
src/feedback.cpp
|
@ -25,6 +25,8 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -36,6 +38,7 @@
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
#include <i18n.h>
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
|
@ -94,8 +97,8 @@ std::string taskDifferences (const Task& before, const Task& after)
|
||||||
std::vector <std::string>::iterator name;
|
std::vector <std::string>::iterator name;
|
||||||
for (name = beforeOnly.begin (); name != beforeOnly.end (); ++name)
|
for (name = beforeOnly.begin (); name != beforeOnly.end (); ++name)
|
||||||
out << " - "
|
out << " - "
|
||||||
<< ucFirst(*name)
|
<< format (STRING_FEEDBACK_DELETED, ucFirst (*name))
|
||||||
<< " will be deleted.\n";
|
<< "\n";
|
||||||
|
|
||||||
for (name = afterOnly.begin (); name != afterOnly.end (); ++name)
|
for (name = afterOnly.begin (); name != afterOnly.end (); ++name)
|
||||||
{
|
{
|
||||||
|
@ -107,17 +110,15 @@ std::string taskDifferences (const Task& before, const Task& after)
|
||||||
join (to, ", ", deps_after);
|
join (to, ", ", deps_after);
|
||||||
|
|
||||||
out << " - "
|
out << " - "
|
||||||
<< "Dependencies"
|
<< format (STRING_FEEDBACK_DEP_SET, to)
|
||||||
<< " will be set to '"
|
<< "\n";
|
||||||
<< to
|
|
||||||
<< "'.\n";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out << " - "
|
out << " - "
|
||||||
<< ucFirst(*name)
|
<< format (STRING_FEEDBACK_ATT_SET,
|
||||||
<< " will be set to '"
|
ucFirst (*name),
|
||||||
<< renderAttribute (*name, after.get (*name))
|
renderAttribute (*name, after.get (*name)))
|
||||||
<< "'.\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (name = beforeAtts.begin (); name != beforeAtts.end (); ++name)
|
for (name = beforeAtts.begin (); name != beforeAtts.end (); ++name)
|
||||||
|
@ -142,27 +143,24 @@ std::string taskDifferences (const Task& before, const Task& after)
|
||||||
join (to, ", ", deps_after);
|
join (to, ", ", deps_after);
|
||||||
|
|
||||||
out << " - "
|
out << " - "
|
||||||
<< "Dependencies"
|
<< format (STRING_FEEDBACK_DEP_MOD, from, to)
|
||||||
<< " will be changed from '"
|
<< "\n";
|
||||||
<< from
|
|
||||||
<< "' to '"
|
|
||||||
<< to
|
|
||||||
<< "'.\n";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out << " - "
|
out << " - "
|
||||||
<< ucFirst(*name)
|
<< format (STRING_FEEDBACK_ATT_MOD,
|
||||||
<< " will be changed from '"
|
ucFirst (*name),
|
||||||
<< renderAttribute (*name, before.get (*name))
|
renderAttribute (*name, before.get (*name)),
|
||||||
<< "' to '"
|
renderAttribute (*name, after.get (*name)))
|
||||||
<< renderAttribute (*name, after.get (*name))
|
<< "\n";
|
||||||
<< "'.\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shouldn't just say nothing.
|
// Shouldn't just say nothing.
|
||||||
if (out.str ().length () == 0)
|
if (out.str ().length () == 0)
|
||||||
out << " - No changes will be made.\n";
|
out << " - "
|
||||||
|
<< STRING_FEEDBACK_NOP
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
return out.str ();
|
return out.str ();
|
||||||
}
|
}
|
||||||
|
@ -197,20 +195,18 @@ std::string taskInfoDifferences (const Task& before, const Task& after)
|
||||||
std::string from;
|
std::string from;
|
||||||
join (from, ", ", deps_before);
|
join (from, ", ", deps_before);
|
||||||
|
|
||||||
out << "Dependencies '"
|
out << format (STRING_FEEDBACK_DEP_DEL, from)
|
||||||
<< from
|
<< "\n";
|
||||||
<< "' deleted.\n";
|
|
||||||
}
|
}
|
||||||
else if (name->substr (0, 11) == "annotation_")
|
else if (name->substr (0, 11) == "annotation_")
|
||||||
{
|
{
|
||||||
out << "Annotation '"
|
out << format (STRING_FEEDBACK_ANN_DEL, before.get (*name))
|
||||||
<< before.get (*name)
|
<< "\n";
|
||||||
<< "' deleted.\n";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << ucFirst (*name)
|
out << format (STRING_FEEDBACK_ATT_DEL, ucFirst (*name))
|
||||||
<< " deleted.\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,22 +219,19 @@ std::string taskInfoDifferences (const Task& before, const Task& after)
|
||||||
std::string to;
|
std::string to;
|
||||||
join (to, ", ", deps_after);
|
join (to, ", ", deps_after);
|
||||||
|
|
||||||
out << "Dependencies"
|
out << format (STRING_FEEDBACK_DEP_WAS_SET, to)
|
||||||
<< " set to '"
|
<< "\n";
|
||||||
<< to
|
|
||||||
<< "'.\n";
|
|
||||||
}
|
}
|
||||||
else if (name->substr (0, 11) == "annotation_")
|
else if (name->substr (0, 11) == "annotation_")
|
||||||
{
|
{
|
||||||
out << "Annotation of '"
|
out << format (STRING_FEEDBACK_ANN_ADD, after.get (*name))
|
||||||
<< after.get (*name)
|
<< "\n";
|
||||||
<< "' added.\n";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out << ucFirst(*name)
|
out << format (STRING_FEEDBACK_ATT_WAS_SET,
|
||||||
<< " set to '"
|
ucFirst (*name),
|
||||||
<< renderAttribute (*name, after.get (*name))
|
renderAttribute (*name, after.get (*name)))
|
||||||
<< "'.\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (name = beforeAtts.begin (); name != beforeAtts.end (); ++name)
|
for (name = beforeAtts.begin (); name != beforeAtts.end (); ++name)
|
||||||
|
@ -258,31 +251,26 @@ std::string taskInfoDifferences (const Task& before, const Task& after)
|
||||||
std::string to;
|
std::string to;
|
||||||
join (to, ", ", deps_after);
|
join (to, ", ", deps_after);
|
||||||
|
|
||||||
out << "Dependencies"
|
out << format (STRING_FEEDBACK_DEP_WAS_MOD, from, to)
|
||||||
<< " changed from '"
|
<< "\n";
|
||||||
<< from
|
|
||||||
<< "' to '"
|
|
||||||
<< to
|
|
||||||
<< "'.\n";
|
|
||||||
}
|
}
|
||||||
else if (name->substr (0, 11) == "annotation_")
|
else if (name->substr (0, 11) == "annotation_")
|
||||||
{
|
{
|
||||||
out << "Annotation changed to '"
|
out << format (STRING_FEEDBACK_ANN_WAS_MOD, after.get (*name))
|
||||||
<< after.get (*name)
|
<< "\n";
|
||||||
<< "'.\n";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out << ucFirst(*name)
|
out << format (STRING_FEEDBACK_ATT_WAS_MOD,
|
||||||
<< " changed from '"
|
ucFirst (*name),
|
||||||
<< renderAttribute (*name, before.get (*name))
|
renderAttribute (*name, before.get (*name)),
|
||||||
<< "' to '"
|
renderAttribute (*name, after.get (*name)))
|
||||||
<< renderAttribute (*name, after.get (*name))
|
<< "\n";
|
||||||
<< "'.\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shouldn't just say nothing.
|
// Shouldn't just say nothing.
|
||||||
if (out.str ().length () == 0)
|
if (out.str ().length () == 0)
|
||||||
out << "No changes made.\n";
|
out << STRING_FEEDBACK_WAS_NOP
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
return out.str ();
|
return out.str ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
#include <ViewText.h>
|
#include <ViewText.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
#include <i18n.h>
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
|
|
||||||
static void countTasks (const std::vector <Task>&, const std::string&, int&, int&);
|
static void countTasks (const std::vector <Task>&, const std::string&, int&, int&);
|
||||||
|
@ -127,9 +129,8 @@ std::string onProjectChange (Task& task, bool scope /* = true */)
|
||||||
if (project != "")
|
if (project != "")
|
||||||
{
|
{
|
||||||
if (scope)
|
if (scope)
|
||||||
msg << "The project '"
|
msg << format (STRING_HELPER_PROJECT_CHANGE, project)
|
||||||
<< project
|
<< " ";
|
||||||
<< "' has changed. ";
|
|
||||||
|
|
||||||
// Count pending and done tasks, for this project.
|
// Count pending and done tasks, for this project.
|
||||||
int count_pending = 0;
|
int count_pending = 0;
|
||||||
|
@ -151,15 +152,10 @@ std::string onProjectChange (Task& task, bool scope /* = true */)
|
||||||
else
|
else
|
||||||
percentage = (count_done * 100 / (count_done + count_pending));
|
percentage = (count_done * 100 / (count_done + count_pending));
|
||||||
|
|
||||||
msg << "Project '"
|
msg << format (STRING_HELPER_PROJECT_COMPL, project, percentage)
|
||||||
<< project
|
<< " "
|
||||||
<< "' is "
|
<< format (STRING_HELPER_PROJECT_REM, count_pending, count_pending + count_done)
|
||||||
<< percentage
|
<< "\n";
|
||||||
<< "% complete ("
|
|
||||||
<< count_pending
|
|
||||||
<< " of "
|
|
||||||
<< (count_pending + count_done)
|
|
||||||
<< " tasks remaining).\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg.str ();
|
return msg.str ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue