- Localized the new strings in Hooks.cpp.
This commit is contained in:
Paul Beckingham 2015-02-15 02:03:24 -05:00
parent 5d96547c07
commit 0a62061ca8
9 changed files with 129 additions and 32 deletions

View file

@ -41,6 +41,7 @@
#include <Timer.h> #include <Timer.h>
#include <text.h> #include <text.h>
#include <util.h> #include <util.h>
#include <i18n.h>
extern Context context; extern Context context;
@ -109,7 +110,7 @@ bool Hooks::enable (bool value)
// - none // - none
// //
// Output: // Output:
// - all emitted JSON is ignored. // - JSON not allowed.
// - all emitted non-JSON lines are considered feedback or error messages // - all emitted non-JSON lines are considered feedback or error messages
// depending on the status code. // depending on the status code.
// //
@ -420,7 +421,7 @@ void Hooks::assertValidJSON (const std::vector <std::string>& input) const
(*i)[0] != '{' || (*i)[0] != '{' ||
(*i)[i->length () - 1] != '}') (*i)[i->length () - 1] != '}')
{ {
context.error ("Hook Error: JSON Object '{...}' expected."); context.error (STRING_HOOK_ERROR_OBJECT);
throw 0; throw 0;
} }
@ -429,34 +430,34 @@ void Hooks::assertValidJSON (const std::vector <std::string>& input) const
json::value* root = json::parse (*i); json::value* root = json::parse (*i);
if (root->type () != json::j_object) if (root->type () != json::j_object)
{ {
context.error ("Hook Error: JSON Object '{...}' expected."); context.error (STRING_HOOK_ERROR_OBJECT);
throw 0; throw 0;
} }
if (((json::object*)root)->_data.find ("description") == ((json::object*)root)->_data.end ()) if (((json::object*)root)->_data.find ("description") == ((json::object*)root)->_data.end ())
{ {
context.error ("Hook Error: JSON Object missing 'description' attribute."); context.error (STRING_HOOK_ERROR_NODESC);
throw 0; throw 0;
} }
if (((json::object*)root)->_data.find ("uuid") == ((json::object*)root)->_data.end ()) if (((json::object*)root)->_data.find ("uuid") == ((json::object*)root)->_data.end ())
{ {
context.error ("Hook Error: JSON Object missing 'uuid' attribute."); context.error (STRING_HOOK_ERROR_NOUUID);
throw 0; throw 0;
} }
} }
catch (const std::string& e) catch (const std::string& e)
{ {
context.error ("Hook Error: JSON syntax error in: " + *i); context.error (format (STRING_HOOK_ERROR_SYNTAX, *i));
if (_debug) if (_debug)
context.error ("Hook Error: JSON " + e); context.error (STRING_HOOK_ERROR_JSON + e);
throw 0; throw 0;
} }
catch (...) catch (...)
{ {
context.error ("Hook Error: JSON failed to parse: " + *i); context.error (STRING_HOOK_ERROR_NOPARSE + *i);
throw 0; throw 0;
} }
} }
@ -467,7 +468,7 @@ void Hooks::assertNTasks (const std::vector <std::string>& input, int n) const
{ {
if (input.size () != n) if (input.size () != n)
{ {
context.error (format ("Hook Error: Expected {1} JSON task(s), found {2}", n, (int) input.size ())); context.error (format (STRING_HOOK_ERROR_BAD_NUM, n, (int) input.size ()));
throw 0; throw 0;
} }
} }
@ -487,7 +488,7 @@ void Hooks::assertSameTask (const std::vector <std::string>& input, const Task&
if (u == root_obj->_data.end () || if (u == root_obj->_data.end () ||
u->second->type () != json::j_string) u->second->type () != json::j_string)
{ {
context.error (format ("Hook Error: JSON must be for the same task: {1}", uuid)); context.error (format (STRING_HOOK_ERROR_SAME1, uuid));
throw 0; throw 0;
} }
@ -495,7 +496,7 @@ void Hooks::assertSameTask (const std::vector <std::string>& input, const Task&
std::string json_uuid = json::decode (unquoteText (up->dump ())); std::string json_uuid = json::decode (unquoteText (up->dump ()));
if (json_uuid != uuid) if (json_uuid != uuid)
{ {
context.error (format ("Hook Error: JSON must be for the same task: {1} != {2}", uuid, json_uuid)); context.error (format (STRING_HOOK_ERROR_SAME2, uuid, json_uuid));
throw 0; throw 0;
} }
} }
@ -512,7 +513,7 @@ void Hooks::assertFeedback (const std::vector <std::string>& input) const
if (! foundSomething) if (! foundSomething)
{ {
context.error ("Hook Error: Expected feedback from a failing hook script."); context.error (STRING_HOOK_ERROR_NOFEEDBACK);
throw 0; throw 0;
} }
} }

View file

@ -792,10 +792,22 @@
#define STRING_FILE_PERMS "Taskwarrior hat die erforderlichen Rechte auf '{1}' nicht." #define STRING_FILE_PERMS "Taskwarrior hat die erforderlichen Rechte auf '{1}' nicht."
// helpers // helpers
#define STRING_HELPER_PROJECT_CHANGE "Projekt '{1}' wurde geändert." #define STRING_HELPER_PROJECT_CHANGE "The project '{1}' has changed."
#define STRING_HELPER_PROJECT_COMPL "Projekt '{1}' ist zu {2}% abgeschlossen" #define STRING_HELPER_PROJECT_COMPL "Project '{1}' is {2}% complete"
#define STRING_HELPER_PROJECT_REM "({1} von {2} Aufgaben verbleibend)." #define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)."
#define STRING_HELPER_PROJECT_REM1 "({1} Aufgabe verbleibend)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected."
#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute."
#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute."
#define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: "
#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}"
#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}"
#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}"
#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script."
// JSON // JSON
#define STRING_JSON_MISSING_VALUE "Fehler: Fehlender Wert nach ',' an Position {1}" #define STRING_JSON_MISSING_VALUE "Fehler: Fehlender Wert nach ',' an Position {1}"

View file

@ -797,6 +797,18 @@
#define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)." #define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)."
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected."
#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute."
#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute."
#define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: "
#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}"
#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}"
#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}"
#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script."
// JSON // JSON
#define STRING_JSON_MISSING_VALUE "Error: missing value after ',' at position {1}" #define STRING_JSON_MISSING_VALUE "Error: missing value after ',' at position {1}"
#define STRING_JSON_MISSING_VALUE2 "Error: missing value at position {1}" #define STRING_JSON_MISSING_VALUE2 "Error: missing value at position {1}"

View file

@ -792,10 +792,22 @@
#define STRING_FILE_PERMS "Taskwarrior ne havas la bezonatan permeson por '{1}'." #define STRING_FILE_PERMS "Taskwarrior ne havas la bezonatan permeson por '{1}'."
// helpers // helpers
#define STRING_HELPER_PROJECT_CHANGE "Projekto '{1}' ŝanĝis." #define STRING_HELPER_PROJECT_CHANGE "The project '{1}' has changed."
#define STRING_HELPER_PROJECT_COMPL "Projekto '{1}' estas {2}% kompleta" #define STRING_HELPER_PROJECT_COMPL "Project '{1}' is {2}% complete"
#define STRING_HELPER_PROJECT_REM "(Restas {1} de {2} taskoj)." #define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)."
#define STRING_HELPER_PROJECT_REM1 "(Restas {1} tasko)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected."
#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute."
#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute."
#define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: "
#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}"
#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}"
#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}"
#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script."
// JSON // JSON
#define STRING_JSON_MISSING_VALUE "Eraro: mankas valoro post ',' ĉe pozicio {1}" #define STRING_JSON_MISSING_VALUE "Eraro: mankas valoro post ',' ĉe pozicio {1}"

View file

@ -801,10 +801,22 @@
#define STRING_FILE_PERMS "Taskwarrior no tiene los permisos adecuados para '{1}'." #define STRING_FILE_PERMS "Taskwarrior no tiene los permisos adecuados para '{1}'."
// helpers // helpers
#define STRING_HELPER_PROJECT_CHANGE "El proyecto '{1}' ha cambiado." #define STRING_HELPER_PROJECT_CHANGE "The project '{1}' has changed."
#define STRING_HELPER_PROJECT_COMPL "El proyecto '{1}' se ha completado en un {2}%" #define STRING_HELPER_PROJECT_COMPL "Project '{1}' is {2}% complete"
#define STRING_HELPER_PROJECT_REM "(quedan {1} de {2} tareas)." #define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)."
#define STRING_HELPER_PROJECT_REM1 "(quada {1} tasko)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected."
#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute."
#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute."
#define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: "
#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}"
#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}"
#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}"
#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script."
// JSON // JSON
#define STRING_JSON_MISSING_VALUE "Error: falta valor después de ',' en posición {1}" #define STRING_JSON_MISSING_VALUE "Error: falta valor después de ',' en posición {1}"

View file

@ -797,6 +797,18 @@
#define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)." #define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)."
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected."
#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute."
#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute."
#define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: "
#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}"
#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}"
#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}"
#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script."
// JSON // JSON
#define STRING_JSON_MISSING_VALUE "Erreur : valeur manquante après ',' à la position {1}" #define STRING_JSON_MISSING_VALUE "Erreur : valeur manquante après ',' à la position {1}"
#define STRING_JSON_MISSING_VALUE2 "Erreur : valeur manquante à la position {1}" #define STRING_JSON_MISSING_VALUE2 "Erreur : valeur manquante à la position {1}"

View file

@ -796,6 +796,18 @@
#define STRING_HELPER_PROJECT_REM "({1} di {2} task rimanenti)." #define STRING_HELPER_PROJECT_REM "({1} di {2} task rimanenti)."
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected."
#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute."
#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute."
#define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: "
#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}"
#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}"
#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}"
#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script."
// JSON // JSON
#define STRING_JSON_MISSING_VALUE "Errore: mancato valore dopo ',' alla posizione {1}" #define STRING_JSON_MISSING_VALUE "Errore: mancato valore dopo ',' alla posizione {1}"
#define STRING_JSON_MISSING_VALUE2 "Errore: mancato valore alla posizione {1}" #define STRING_JSON_MISSING_VALUE2 "Errore: mancato valore alla posizione {1}"

View file

@ -792,10 +792,22 @@
#define STRING_FILE_PERMS "Taskwarrior nie posiada praw dostępu do '{1}'." #define STRING_FILE_PERMS "Taskwarrior nie posiada praw dostępu do '{1}'."
// helpers // helpers
#define STRING_HELPER_PROJECT_CHANGE "Projekt '{1}' uległ zmianie." #define STRING_HELPER_PROJECT_CHANGE "The project '{1}' has changed."
#define STRING_HELPER_PROJECT_COMPL "Projekt '{1}' w {2}% ukończony" #define STRING_HELPER_PROJECT_COMPL "Project '{1}' is {2}% complete"
#define STRING_HELPER_PROJECT_REM "({1} z {2} zadań pozostało)." #define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)."
#define STRING_HELPER_PROJECT_REM1 "({1} zadań pozostało)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected."
#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute."
#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute."
#define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: "
#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}"
#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}"
#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}"
#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script."
// JSON // JSON
#define STRING_JSON_MISSING_VALUE "Błąd: brak wartości po ',' na pozycji {1}" #define STRING_JSON_MISSING_VALUE "Błąd: brak wartości po ',' na pozycji {1}"

View file

@ -792,10 +792,22 @@
#define STRING_FILE_PERMS "O taskwarrior não encontrou as permissões corretas em '{1}'." #define STRING_FILE_PERMS "O taskwarrior não encontrou as permissões corretas em '{1}'."
// helpers // helpers
#define STRING_HELPER_PROJECT_CHANGE "O projeto '{1}' foi alterado." #define STRING_HELPER_PROJECT_CHANGE "The project '{1}' has changed."
#define STRING_HELPER_PROJECT_COMPL "Projeto '{1}' está {2}% concluído" #define STRING_HELPER_PROJECT_COMPL "Project '{1}' is {2}% complete"
#define STRING_HELPER_PROJECT_REM "(Restam {1} de {2} tarefas)." #define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)."
#define STRING_HELPER_PROJECT_REM1 "({1} tarefas em falta)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected."
#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute."
#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute."
#define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: "
#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}"
#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}"
#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}"
#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script."
// JSON // JSON
#define STRING_JSON_MISSING_VALUE "Erro: valor em falta após ',' na posição {1}" #define STRING_JSON_MISSING_VALUE "Erro: valor em falta após ',' na posição {1}"