From 378799e27d75b5c739dd69aa9fba5b30df2c410f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 4 Jul 2014 18:03:25 -0400 Subject: [PATCH] L10N - Localized Parser. --- src/Parser.cpp | 21 ++++++++------------- src/eng-USA.h | 17 ++++++++++------- src/esp-ESP.h | 17 ++++++++++------- src/fra-FRA.h | 17 ++++++++++------- src/ita-ITA.h | 17 ++++++++++------- src/por-PRT.h | 17 ++++++++++------- 6 files changed, 58 insertions(+), 48 deletions(-) diff --git a/src/Parser.cpp b/src/Parser.cpp index 9702ecfec..e9cdaffbb 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -53,8 +53,6 @@ static int safetyValveDefault = 10; Parser::Parser () { _tree = new Tree ("root"); - if (! _tree) - throw std::string ("Failed to allocate memory for parse tree."); } //////////////////////////////////////////////////////////////////////////////// @@ -117,10 +115,7 @@ void Parser::initialize (int argc, const char** argv) void Parser::clear () { delete _tree; - _tree = new Tree ("root"); - if (! _tree) - throw std::string ("Failed to allocate memory for parse tree."); } //////////////////////////////////////////////////////////////////////////////// @@ -376,7 +371,7 @@ void Parser::resolveAliases () while (something && --safety_valve > 0); if (safety_valve <= 0) - context.debug (format ("Nested alias limit of {1} reached.", safetyValveDefault)); + context.debug (format (STRING_PARSER_ALIAS_NEST, safetyValveDefault)); } //////////////////////////////////////////////////////////////////////////////// @@ -482,7 +477,7 @@ void Parser::getOverrides ( else home = "."; - context.header (format (STRING_A3_ALTERNATE_RC, rc._data)); + context.header (format (STRING_PARSER_ALTERNATE_RC, rc._data)); // Keep looping, because if there are multiple rc:file arguments, we // want the last one to dominate. @@ -505,7 +500,7 @@ void Parser::getDataLocation (Path& data) (*i)->attribute ("name") == "data.location") { data = Directory ((*i)->attribute ("value")); - context.header (format (STRING_A3_ALTERNATE_DATA, (std::string) data)); + context.header (format (STRING_PARSER_ALTERNATE_DATA, (std::string) data)); } // Keep looping, because if there are multiple overrides, we want the last @@ -526,7 +521,7 @@ void Parser::applyOverrides () std::string name = (*i)->attribute ("name"); std::string value = (*i)->attribute ("value"); context.config.set (name, value); - context.footnote (format (STRING_A3_OVERRIDE_RC, name, value)); + context.footnote (format (STRING_PARSER_OVERRIDE_RC, name, value)); } } } @@ -1147,7 +1142,7 @@ void Parser::findAttributeModifier () #endif } else - throw format (STRING_A3_UNKNOWN_ATTMOD, modifier); + throw format (STRING_PARSER_UNKNOWN_ATTMOD, modifier); std::map ::const_iterator col; col = context.columns.find (canonical); @@ -1229,7 +1224,7 @@ void Parser::findIdSequence () n_max.depleted ()) { if (id_min > id_max) - throw std::string (STRING_A3_RANGE_INVERTED); + throw std::string (STRING_PARSER_RANGE_INVERTED); ranges.push_back (std::pair (id_min, id_max)); } @@ -1240,7 +1235,7 @@ void Parser::findIdSequence () } } else - throw std::string (STRING_A3_MALFORMED_ID); + throw std::string (STRING_PARSER_MALFORMED_ID); } if (not_an_id) @@ -1347,7 +1342,7 @@ void Parser::findUUIDList () { if (!n.getUUID (uuid) && !n.getPartialUUID (uuid)) - throw std::string (STRING_A3_UUID_AFTER_COMMA); + throw std::string (STRING_PARSER_UUID_AFTER_COMMA); sequence.push_back (uuid); } diff --git a/src/eng-USA.h b/src/eng-USA.h index e9369573b..3365d5aa4 100644 --- a/src/eng-USA.h +++ b/src/eng-USA.h @@ -101,20 +101,23 @@ #define STRING_LOCALIZATION_DESC "English localization" #define STRING_LOCALIZATION_AUTHOR "Translated into English by A. Person." +// Parser +#define STRING_PARSER_ALIAS_NEST "Nested alias limit of {1} reached." +#define STRING_PARSER_OVERRIDE_RC "Configuration override rc.{1}:{2}" +#define STRING_PARSER_UNKNOWN_ATTMOD "Error: unrecognized attribute modifier '{1}'." +#define STRING_PARSER_RANGE_INVERTED "Inverted range 'high-low' instead of 'low-high'" +#define STRING_PARSER_MALFORMED_ID "Malformed ID." +#define STRING_PARSER_UUID_AFTER_COMMA "Unrecognized UUID after comma." +#define STRING_PARSER_ALTERNATE_RC "Using alternate .taskrc file {1}" +#define STRING_PARSER_ALTERNATE_DATA "Using alternate data.location {1}" + // A3 -#define STRING_A3_ALTERNATE_RC "Using alternate .taskrc file {1}" -#define STRING_A3_ALTERNATE_DATA "Using alternate data.location {1}" -#define STRING_A3_OVERRIDE_RC "Configuration override rc.{1}:{2}" #define STRING_A3_OVERRIDE_PROBLEM "Problem with override: {1}" -#define STRING_A3_UNKNOWN_ATTMOD "Error: unrecognized attribute modifier '{1}'." #define STRING_A3_MISMATCHED_PARENS "Mismatched parentheses in expression" #define STRING_A3_PATTERN_GARBAGE "Unrecognized character(s) at end of pattern." #define STRING_A3_MALFORMED_PATTERN "Malformed pattern." -#define STRING_A3_MALFORMED_ID "Malformed ID." #define STRING_A3_MALFORMED_UUID "Malformed UUID." #define STRING_A3_ID_AFTER_HYPHEN "Unrecognized ID after hyphen." -#define STRING_A3_RANGE_INVERTED "Inverted range 'high-low' instead of 'low-high'" -#define STRING_A3_UUID_AFTER_COMMA "Unrecognized UUID after comma." #define STRING_A3_ZERO_ID "'{1}' is not a valid ID." // Color diff --git a/src/esp-ESP.h b/src/esp-ESP.h index 9f57f0f36..6b9658dfb 100644 --- a/src/esp-ESP.h +++ b/src/esp-ESP.h @@ -101,21 +101,24 @@ #define STRING_LOCALIZATION_DESC "- localización española" #define STRING_LOCALIZATION_AUTHOR "Traducido al español por Fidel Mato." +// Parser +#define STRING_PARSER_ALIAS_NEST "Nested alias limit of {1} reached." +#define STRING_PARSER_OVERRIDE_RC "Sobrescritura de configuración rc.{1}:{2}" +#define STRING_PARSER_UNKNOWN_ATTMOD "Error: modificador de atributo no reconocido '{1}'." +#define STRING_PARSER_RANGE_INVERTED "Rango invertido 'alto-bajo' en vez de 'bajo-alto'" +#define STRING_PARSER_MALFORMED_ID "ID incorrecto." +#define STRING_PARSER_UUID_AFTER_COMMA "UUID no reconocido tras coma." +#define STRING_PARSER_ALTERNATE_RC "Usando el archivo .taskrc alternativo {1}" +#define STRING_PARSER_ALTERNATE_DATA "Usando data.location alternativa {1}" + // A3 -#define STRING_A3_ALTERNATE_RC "Usando el archivo .taskrc alternativo {1}" -#define STRING_A3_ALTERNATE_DATA "Usando data.location alternativa {1}" // Sobrescritura: de R.A.E. sobrescribir -#define STRING_A3_OVERRIDE_RC "Sobrescritura de configuración rc.{1}:{2}" #define STRING_A3_OVERRIDE_PROBLEM "Problema con sobrescritura: {1}" -#define STRING_A3_UNKNOWN_ATTMOD "Error: modificador de atributo no reconocido '{1}'." #define STRING_A3_MISMATCHED_PARENS "Paréntesis desemparejados en expresión" #define STRING_A3_PATTERN_GARBAGE "Carácter(es) no reconocido(s) al final del patrón." #define STRING_A3_MALFORMED_PATTERN "Patrón incorrecto." -#define STRING_A3_MALFORMED_ID "ID incorrecto." #define STRING_A3_MALFORMED_UUID "UUID incorrecto." #define STRING_A3_ID_AFTER_HYPHEN "ID no reconocido tras guión." -#define STRING_A3_RANGE_INVERTED "Rango invertido 'alto-bajo' en vez de 'bajo-alto'" -#define STRING_A3_UUID_AFTER_COMMA "UUID no reconocido tras coma." #define STRING_A3_ZERO_ID "'{1}' no es un ID válido." // Color diff --git a/src/fra-FRA.h b/src/fra-FRA.h index 509ec4392..293078e3d 100644 --- a/src/fra-FRA.h +++ b/src/fra-FRA.h @@ -101,20 +101,23 @@ #define STRING_LOCALIZATION_DESC "Traduction française" #define STRING_LOCALIZATION_AUTHOR "Traduit en Français par Leowzukw." +// Parser +#define STRING_PARSER_ALIAS_NEST "Nested alias limit of {1} reached." +#define STRING_PARSER_OVERRIDE_RC "Configuration écrasée : rc.{1}:{2}" +#define STRING_PARSER_UNKNOWN_ATTMOD "Erreur : attribut de modification non reconnu '{1}'." +#define STRING_PARSER_RANGE_INVERTED "Inverted range 'high-low' instead of 'low-high'" +#define STRING_PARSER_MALFORMED_ID "ID mal formé." +#define STRING_PARSER_UUID_AFTER_COMMA "UUID non reconnu après la virgule." +#define STRING_PARSER_ALTERNATE_RC "Utilise un fichier .taskrc alternatif : {1}" +#define STRING_PARSER_ALTERNATE_DATA "Utilise une data.location alternative : {1}" + // A3 -#define STRING_A3_ALTERNATE_RC "Utilise un fichier .taskrc alternatif : {1}" -#define STRING_A3_ALTERNATE_DATA "Utilise une data.location alternative : {1}" -#define STRING_A3_OVERRIDE_RC "Configuration écrasée : rc.{1}:{2}" #define STRING_A3_OVERRIDE_PROBLEM "Problème avec l'écrasement de {1}" -#define STRING_A3_UNKNOWN_ATTMOD "Erreur : attribut de modification non reconnu '{1}'." #define STRING_A3_MISMATCHED_PARENS "Parenthèses incohérentes dans l'expression" #define STRING_A3_PATTERN_GARBAGE "Caractère(s) non reconnu(s) à la fin du motif." #define STRING_A3_MALFORMED_PATTERN "Motif mal formé." -#define STRING_A3_MALFORMED_ID "ID mal formé." #define STRING_A3_MALFORMED_UUID "UUID mal formé." #define STRING_A3_ID_AFTER_HYPHEN "ID non reconnu après \"-\"" -#define STRING_A3_RANGE_INVERTED "Inverted range 'high-low' instead of 'low-high'" -#define STRING_A3_UUID_AFTER_COMMA "UUID non reconnu après la virgule." #define STRING_A3_ZERO_ID "'{1}' n'est pas un ID valide." // Color diff --git a/src/ita-ITA.h b/src/ita-ITA.h index cd987415f..882ab62e6 100644 --- a/src/ita-ITA.h +++ b/src/ita-ITA.h @@ -102,20 +102,23 @@ #define STRING_LOCALIZATION_DESC "Traduzione in Italiano" #define STRING_LOCALIZATION_AUTHOR "Tradotto in Italiano da Tullio Facchinetti." +// Parser +#define STRING_PARSER_ALIAS_NEST "Nested alias limit of {1} reached." +#define STRING_PARSER_OVERRIDE_RC "Modifica configurazione rc.{1}:{2}" +#define STRING_PARSER_UNKNOWN_ATTMOD "Errore: modificatore di attributo non riconosciuto '{1}'." +#define STRING_PARSER_RANGE_INVERTED "Intervallo invertito 'alto-basso' invece di 'basso-alto'" +#define STRING_PARSER_MALFORMED_ID "ID malformato." +#define STRING_PARSER_UUID_AFTER_COMMA "UUID non riconosciuto dopo la virgola." +#define STRING_PARSER_ALTERNATE_RC "Uso del file .taskrc alternativo {1}" +#define STRING_PARSER_ALTERNATE_DATA "Uso di data.location alternativa {1}" + // A3 -#define STRING_A3_ALTERNATE_RC "Uso del file .taskrc alternativo {1}" -#define STRING_A3_ALTERNATE_DATA "Uso di data.location alternativa {1}" -#define STRING_A3_OVERRIDE_RC "Modifica configurazione rc.{1}:{2}" #define STRING_A3_OVERRIDE_PROBLEM "Problema di modifica: {1}" -#define STRING_A3_UNKNOWN_ATTMOD "Errore: modificatore di attributo non riconosciuto '{1}'." #define STRING_A3_MISMATCHED_PARENS "Mancata corrispondenza nell'uso delle parentesi nell'espressione" #define STRING_A3_PATTERN_GARBAGE "Carattere(i) non riconosciuto(i) alla fine del pattern." #define STRING_A3_MALFORMED_PATTERN "Pattern malformato." -#define STRING_A3_MALFORMED_ID "ID malformato." #define STRING_A3_MALFORMED_UUID "UUID malformato." #define STRING_A3_ID_AFTER_HYPHEN "ID non riconosciuto dopo il trattino." -#define STRING_A3_RANGE_INVERTED "Intervallo invertito 'alto-basso' invece di 'basso-alto'" -#define STRING_A3_UUID_AFTER_COMMA "UUID non riconosciuto dopo la virgola." #define STRING_A3_ZERO_ID "'{1}' is not a valid ID." // Color diff --git a/src/por-PRT.h b/src/por-PRT.h index 825a34fbc..aaedce030 100644 --- a/src/por-PRT.h +++ b/src/por-PRT.h @@ -101,20 +101,23 @@ #define STRING_LOCALIZATION_DESC "Tradução em Português" #define STRING_LOCALIZATION_AUTHOR "Traduzido para Português por Renato Alves." +// Parser +#define STRING_PARSER_ALIAS_NEST "Nested alias limit of {1} reached." +#define STRING_PARSER_OVERRIDE_RC "Alteração de configuração rc.{1}:{2}" +#define STRING_PARSER_UNKNOWN_ATTMOD "Erro: modificador de atributo não reconhecido '{1}'." +#define STRING_PARSER_RANGE_INVERTED "Intervalo invertido 'alta-baixa' em vez de 'baixa-alta'" +#define STRING_PARSER_MALFORMED_ID "ID malformado." +#define STRING_PARSER_UUID_AFTER_COMMA "UUID não reconhecido após a vírgula." +#define STRING_PARSER_ALTERNATE_RC "Usando o ficheiro .taskrc alternativo {1}" +#define STRING_PARSER_ALTERNATE_DATA "Usando data.location alternativa {1}" + // A3 -#define STRING_A3_ALTERNATE_RC "Usando o ficheiro .taskrc alternativo {1}" -#define STRING_A3_ALTERNATE_DATA "Usando data.location alternativa {1}" -#define STRING_A3_OVERRIDE_RC "Alteração de configuração rc.{1}:{2}" #define STRING_A3_OVERRIDE_PROBLEM "Problema com a alteração: {1}" -#define STRING_A3_UNKNOWN_ATTMOD "Erro: modificador de atributo não reconhecido '{1}'." #define STRING_A3_MISMATCHED_PARENS "Erro de não correspondência de parentesis na expressão" #define STRING_A3_PATTERN_GARBAGE "Caracter(es) não reconhecidos no fim da expressão." #define STRING_A3_MALFORMED_PATTERN "Expressão malformada." -#define STRING_A3_MALFORMED_ID "ID malformado." #define STRING_A3_MALFORMED_UUID "UUID malformado." #define STRING_A3_ID_AFTER_HYPHEN "ID não reconhecido após o hífen." -#define STRING_A3_RANGE_INVERTED "Intervalo invertido 'alta-baixa' em vez de 'baixa-alta'" -#define STRING_A3_UUID_AFTER_COMMA "UUID não reconhecido após a vírgula." #define STRING_A3_ZERO_ID "'{1}' não é um ID válido." // Color