mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
L10N
- Localized Eval.
This commit is contained in:
parent
6eee9e0544
commit
70156d3c3d
6 changed files with 38 additions and 35 deletions
18
src/Eval.cpp
18
src/Eval.cpp
|
@ -24,6 +24,7 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <cmake.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -31,6 +32,8 @@
|
||||||
#include <Task.h>
|
#include <Task.h>
|
||||||
#include <Color.h>
|
#include <Color.h>
|
||||||
#include <Eval.h>
|
#include <Eval.h>
|
||||||
|
#include <text.h>
|
||||||
|
#include <i18n.h>
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
extern Task& contextTask;
|
extern Task& contextTask;
|
||||||
|
@ -228,11 +231,7 @@ void Eval::evaluatePostfixStack (
|
||||||
Variant& result) const
|
Variant& result) const
|
||||||
{
|
{
|
||||||
if (tokens.size () == 0)
|
if (tokens.size () == 0)
|
||||||
{
|
throw std::string (STRING_EVAL_NO_EXPRESSION);
|
||||||
std::cout << "No expression to evaluate.\n";
|
|
||||||
result = Variant ("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is stack used by the postfix evaluator.
|
// This is stack used by the postfix evaluator.
|
||||||
std::vector <Variant> values;
|
std::vector <Variant> values;
|
||||||
|
@ -318,7 +317,7 @@ void Eval::evaluatePostfixStack (
|
||||||
else if (token->first == "_hastag_") left = left.operator_hastag (right, contextTask);
|
else if (token->first == "_hastag_") left = left.operator_hastag (right, contextTask);
|
||||||
else if (token->first == "_notag_") left = left.operator_notag (right, contextTask);
|
else if (token->first == "_notag_") left = left.operator_notag (right, contextTask);
|
||||||
else
|
else
|
||||||
std::cout << "Unrecognized operator '" << token->first << "'\n";
|
throw format (STRING_EVAL_UNSUPPORTED, token->first);
|
||||||
|
|
||||||
if (_debug)
|
if (_debug)
|
||||||
std::cout << "[" << values.size () << "] eval result push '" << (std::string) left << "'\n";
|
std::cout << "[" << values.size () << "] eval result push '" << (std::string) left << "'\n";
|
||||||
|
@ -341,8 +340,7 @@ void Eval::evaluatePostfixStack (
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Lexer::typeOperator:
|
case Lexer::typeOperator:
|
||||||
if (_debug)
|
throw std::string (STRING_EVAL_OP_EXPECTED);
|
||||||
std::cout << "Error: operator unexpected.\n";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Lexer::typeIdentifier:
|
case Lexer::typeIdentifier:
|
||||||
|
@ -393,7 +391,7 @@ void Eval::evaluatePostfixStack (
|
||||||
// If there is more than one variant left on the stack, then the original
|
// If there is more than one variant left on the stack, then the original
|
||||||
// expression was not valid.
|
// expression was not valid.
|
||||||
if (values.size () != 1)
|
if (values.size () != 1)
|
||||||
throw std::string ("The expression could not be evaluated.");
|
throw std::string (STRING_EVAL_NO_EVAL);
|
||||||
|
|
||||||
result = values[0];
|
result = values[0];
|
||||||
}
|
}
|
||||||
|
@ -802,7 +800,7 @@ void Eval::infixToPostfix (
|
||||||
{
|
{
|
||||||
if (op_stack.back ().first == "(" ||
|
if (op_stack.back ().first == "(" ||
|
||||||
op_stack.back ().first == ")")
|
op_stack.back ().first == ")")
|
||||||
throw std::string ("Mismatched parentheses in expression");
|
throw std::string (STRING_PAREN_MISMATCH);
|
||||||
|
|
||||||
postfix.push_back (op_stack.back ());
|
postfix.push_back (op_stack.back ());
|
||||||
op_stack.pop_back ();
|
op_stack.pop_back ();
|
||||||
|
|
|
@ -602,11 +602,12 @@
|
||||||
// Duration
|
// Duration
|
||||||
#define STRING_DURATION_UNRECOGNIZED "The duration '{1}' was not recognized as valid, with correct units like '3days'."
|
#define STRING_DURATION_UNRECOGNIZED "The duration '{1}' was not recognized as valid, with correct units like '3days'."
|
||||||
|
|
||||||
// E9
|
// Eval
|
||||||
#define STRING_E9_UNSUPPORTED "Unsupported operator '{1}'."
|
#define STRING_EVAL_NO_EXPRESSION "No expression to evaluate."
|
||||||
#define STRING_E9_NO_OPERANDS "There are no operands for the '{1}' operator."
|
#define STRING_EVAL_UNSUPPORTED "Unsupported operator '{1}'."
|
||||||
#define STRING_E9_INSUFFICIENT_OP "There are not enough operands for the '{1}' operator."
|
#define STRING_EVAL_OP_EXPECTED "Operator expected."
|
||||||
#define STRING_E9_MORE_OP "Found extra operands."
|
#define STRING_EVAL_NO_EVAL "The expression could not be evaluated."
|
||||||
|
#define STRING_PAREN_MISMATCH "Mismatched parentheses in expression"
|
||||||
|
|
||||||
// edit
|
// edit
|
||||||
#define STRING_EDIT_NO_CHANGES "No edits were detected."
|
#define STRING_EDIT_NO_CHANGES "No edits were detected."
|
||||||
|
|
|
@ -615,11 +615,12 @@
|
||||||
// Duration
|
// Duration
|
||||||
#define STRING_DURATION_UNRECOGNIZED "La duración '{1}' no se reconoció como válida, con unidades correctas como '3days'."
|
#define STRING_DURATION_UNRECOGNIZED "La duración '{1}' no se reconoció como válida, con unidades correctas como '3days'."
|
||||||
|
|
||||||
// E9
|
// Eval
|
||||||
#define STRING_E9_UNSUPPORTED "Operador no soportado '{1}'."
|
#define STRING_EVAL_NO_EXPRESSION "No expression to evaluate."
|
||||||
#define STRING_E9_NO_OPERANDS "No hay operandos para el operador '{1}'."
|
#define STRING_EVAL_UNSUPPORTED "Operador no soportado '{1}'."
|
||||||
#define STRING_E9_INSUFFICIENT_OP "No hay suficientes operandos para el operador '{1}'."
|
#define STRING_EVAL_OP_EXPECTED "Operator expected."
|
||||||
#define STRING_E9_MORE_OP "Encontrados operandos de más."
|
#define STRING_EVAL_NO_EVAL "The expression could not be evaluated."
|
||||||
|
#define STRING_PAREN_MISMATCH "Mismatched parentheses in expression"
|
||||||
|
|
||||||
// edit
|
// edit
|
||||||
#define STRING_EDIT_NO_CHANGES "No se detectaron modificaciones."
|
#define STRING_EDIT_NO_CHANGES "No se detectaron modificaciones."
|
||||||
|
|
|
@ -601,11 +601,12 @@
|
||||||
// Duration
|
// Duration
|
||||||
#define STRING_DURATION_UNRECOGNIZED "The duration '{1}' was not recognized as valid, with correct units like '3days'."
|
#define STRING_DURATION_UNRECOGNIZED "The duration '{1}' was not recognized as valid, with correct units like '3days'."
|
||||||
|
|
||||||
// E9
|
// Eval
|
||||||
#define STRING_E9_UNSUPPORTED "Unsupported operator '{1}'."
|
#define STRING_EVAL_NO_EXPRESSION "No expression to evaluate."
|
||||||
#define STRING_E9_NO_OPERANDS "There are no operands for the '{1}' operator."
|
#define STRING_EVAL_UNSUPPORTED "Unsupported operator '{1}'."
|
||||||
#define STRING_E9_INSUFFICIENT_OP "There are not enough operands for the '{1}' operator."
|
#define STRING_EVAL_OP_EXPECTED "Operator expected."
|
||||||
#define STRING_E9_MORE_OP "Found extra operands."
|
#define STRING_EVAL_NO_EVAL "The expression could not be evaluated."
|
||||||
|
#define STRING_PAREN_MISMATCH "Mismatched parentheses in expression"
|
||||||
|
|
||||||
// edit
|
// edit
|
||||||
#define STRING_EDIT_NO_CHANGES "Aucunes modifications détectées."
|
#define STRING_EDIT_NO_CHANGES "Aucunes modifications détectées."
|
||||||
|
|
|
@ -602,11 +602,12 @@
|
||||||
// Duration
|
// Duration
|
||||||
#define STRING_DURATION_UNRECOGNIZED "La durata '{1}' non è valida, con nità corrette come '3days'."
|
#define STRING_DURATION_UNRECOGNIZED "La durata '{1}' non è valida, con nità corrette come '3days'."
|
||||||
|
|
||||||
// E9
|
// Eval
|
||||||
#define STRING_E9_UNSUPPORTED "Operatore non supportato '{1}'."
|
#define STRING_EVAL_NO_EXPRESSION "No expression to evaluate."
|
||||||
#define STRING_E9_NO_OPERANDS "Non ci sono operandi per l'operatore '{1}'."
|
#define STRING_EVAL_UNSUPPORTED "Operatore non supportato '{1}'."
|
||||||
#define STRING_E9_INSUFFICIENT_OP "Non ci sono abbastanza operandi per l'operatore '{1}'."
|
#define STRING_EVAL_OP_EXPECTED "Operator expected."
|
||||||
#define STRING_E9_MORE_OP "Trovati operandi in eccesso."
|
#define STRING_EVAL_NO_EVAL "The expression could not be evaluated."
|
||||||
|
#define STRING_PAREN_MISMATCH "Mismatched parentheses in expression"
|
||||||
|
|
||||||
// edit
|
// edit
|
||||||
#define STRING_EDIT_NO_CHANGES "Nessuna modifica riscontrata."
|
#define STRING_EDIT_NO_CHANGES "Nessuna modifica riscontrata."
|
||||||
|
|
|
@ -602,11 +602,12 @@
|
||||||
// Duration
|
// Duration
|
||||||
#define STRING_DURATION_UNRECOGNIZED "A duração '{1}' não foi reconhecida como válid, com unidades corretas como '3days'." // Can we translate '3days' to '3dias' ?
|
#define STRING_DURATION_UNRECOGNIZED "A duração '{1}' não foi reconhecida como válid, com unidades corretas como '3days'." // Can we translate '3days' to '3dias' ?
|
||||||
|
|
||||||
// E9
|
// Eval
|
||||||
#define STRING_E9_UNSUPPORTED "Operador não suportado '{1}'."
|
#define STRING_EVAL_NO_EXPRESSION "No expression to evaluate."
|
||||||
#define STRING_E9_NO_OPERANDS "Não existem operandos para o operador '{1}'."
|
#define STRING_EVAL_UNSUPPORTED "Operador não suportado '{1}'."
|
||||||
#define STRING_E9_INSUFFICIENT_OP "Não existem operandos suficientes para o operador '{1}'."
|
#define STRING_EVAL_OP_EXPECTED "Operator expected."
|
||||||
#define STRING_E9_MORE_OP "Operandos em excesso."
|
#define STRING_EVAL_NO_EVAL "The expression could not be evaluated."
|
||||||
|
#define STRING_PAREN_MISMATCH "Mismatched parentheses in expression"
|
||||||
|
|
||||||
// edit
|
// edit
|
||||||
#define STRING_EDIT_NO_CHANGES "Não foram detetadas alterações."
|
#define STRING_EDIT_NO_CHANGES "Não foram detetadas alterações."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue