commit 7be641f6342f6cee64facb658458049d041ab746 Author: Ahmed Siam Date: Thu Jul 13 02:06:55 2023 +0300 i18n of lttoolbox patch 4 diff --git a/locales/root.txt b/locales/root.txt index bc81a28..7f2a385 100644 --- a/locales/root.txt +++ b/locales/root.txt @@ -90,8 +90,8 @@ root{ LTTB1009{"ERROR LTTB1009: Transducer contains initial epsilon loop. Aborting."} LTTB1010{"ERROR LTTB1010: Cannot create empty buffer."} LTTB1011{"ERROR LTTB1011: Parse error at the end of input."} - LTTB1012{"ERROR LTTB1012: Invalid dictionary (hint: the {side} side of an entry is empty)."} - LTTB1013{"ERROR LTTB1013: Invalid dictionary (hint: entry on the {side} beginning with whitespace)."} + LTTB1012{"ERROR LTTB1012: Invalid dictionary (hint: the right side of an entry is empty)."} + LTTB1013{"ERROR LTTB1013: Invalid dictionary (hint: entry on the right beginning with whitespace)."} LTTB1014{"ERROR LTTB1014: On line {line_number}: Missing alphabet symbols."} LTTB1015{"WARNING LTTB1015: Cannot insert from empty input. Ignoring. (You probably want to specify exact tags when deleting a word.)"} LTTB1016{"ERROR LTTB1016: On line {line_number}: Non-empty element \"<{name}>\" should be empty."} @@ -106,7 +106,7 @@ root{ LTTB1025{"ERROR LTTB1025: On line {line_number}: \"<{element_name}>\" element must specify non-void \"{attr_name}\" attribute."} LTTB1026{"ERROR LTTB1026: On line {line_number}: Parse error."} LTTB1027{"ERROR LTTB1027: On line {line_number}: Invalid inclusion of \"<{element_name}>\" into \"<{compiler_entry_element}>\"."} - LTTB1028{"ERROR LTTB1028: On line {line_number}: Invalid node \"<{element_name}>\"."} + LTTB1028{"ERROR LTTB1028: On file \"{file_name}\" line {line_number}: Invalid node \"<{element_name}>\"."} LTTB1029{"ERROR LTTB1029: I/O Error writing."} LTTB1030{"ERROR LTTB1030: Out of range: {value}."} LTTB1031{"ERROR LTTB1031: Can't access file {file_name}."} @@ -152,4 +152,7 @@ root{ LTTB1065{"ERROR LTTB1065: Can't deserialise {size} byte integer type: Can't deserialise byte."} LTTB1066{"ERROR LTTB1066: Can't serialise const {size_a} byte integer type: Can't serialise size {size_b}."} LTTB1067{"ERROR LTTB1067: Can't serialise const {size} byte integer type: Can't serialise byte {byte}."} + LTTB1068{"ERROR LTTB1068: Invalid dictionary (hint: the left side of an entry is empty)."} + LTTB1069{"ERROR LTTB1069: Invalid dictionary (hint: entry on the left beginning with whitespace)."} + LTTB1070{"ERROR LTTB1069: Invalid dictionary (hint: entry on the beginning with whitespace)."} } diff --git a/lttoolbox/compiler.cc b/lttoolbox/compiler.cc index c78423a..d3470a8 100644 --- a/lttoolbox/compiler.cc +++ b/lttoolbox/compiler.cc @@ -121,11 +121,17 @@ Compiler::valid(UStringView dir) const auto initial = fst.getInitial(); for(const auto i : fst.closure(initial, epsilonSymbols)) { if (finals.count(i)) { - i18n.error("LTTB1012", {"side"}, {side}, false); + if (side = "right") + i18n.error("LTTB1012", {}, {}, false); + else + i18n.error("LTTB1068", {}, {}, false); return false; } if(fst.closure(i, spaceSymbols).size() > 1) { // >1 since closure always includes self - i18n.error("LTTB1013", {"side"}, {side}, false); + if (side = "right") + i18n.error("LTTB1013", {}, {}, false); + else + i18n.error("LTTB1069", {}, {}, false); return false; } } @@ -999,8 +1005,9 @@ Compiler::procNode() } else { - i18n.error("LTTB1028", {"line_number", "element_name"}, - {xmlTextReaderGetParserLineNumber(reader), + I18n(LOCALES_DATA).error("LTTB1028", {"file_name", "line_number", "element_name"}, + {(char*)xmlTextReaderCurrentDoc(reader)->URL, + xmlTextReaderGetParserLineNumber(reader), icu::UnicodeString(name.data())}, true); } } diff --git a/lttoolbox/expander.cc b/lttoolbox/expander.cc index 9c75ded..08b48a7 100644 --- a/lttoolbox/expander.cc +++ b/lttoolbox/expander.cc @@ -551,8 +551,9 @@ Expander::procNode(UFILE *output) } else { - I18n(LOCALES_DATA).error("LTTB1028", {"line_number", "element_name"}, - {xmlTextReaderGetParserLineNumber(reader), + I18n(LOCALES_DATA).error("LTTB1028", {"file_name", "line_number", "element_name"}, + {(char*)xmlTextReaderCurrentDoc(reader)->URL, + xmlTextReaderGetParserLineNumber(reader), icu::UnicodeString(name.data())}, true); } } diff --git a/lttoolbox/fst_processor.cc b/lttoolbox/fst_processor.cc index c38b8d1..4a4e9df 100644 --- a/lttoolbox/fst_processor.cc +++ b/lttoolbox/fst_processor.cc @@ -120,8 +120,9 @@ FSTProcessor::procNodeICX() } else { - I18n(LOCALES_DATA).error("LTTB1028", {"line_number", "element_name"}, - {xmlTextReaderGetParserLineNumber(reader), + I18n(LOCALES_DATA).error("LTTB1028", {"file_name", "line_number", "element_name"}, + {(char*)xmlTextReaderCurrentDoc(reader)->URL, + xmlTextReaderGetParserLineNumber(reader), icu::UnicodeString(name.data())}, true); } } @@ -158,8 +159,9 @@ FSTProcessor::procNodeRCX() } else { - I18n(LOCALES_DATA).error("LTTB1028", {"line_number", "element_name"}, - {xmlTextReaderGetParserLineNumber(reader), + I18n(LOCALES_DATA).error("LTTB1028", {"file_name", "line_number", "element_name"}, + {(char*)xmlTextReaderCurrentDoc(reader)->URL, + xmlTextReaderGetParserLineNumber(reader), icu::UnicodeString(name.data())}, true); } } @@ -2325,7 +2327,7 @@ FSTProcessor::valid() const { if(initial_state.isFinal(all_finals)) { - I18n(LOCALES_DATA).error("LTTB1012", {"side"}, {"left"}, false); + I18n(LOCALES_DATA).error("LTTB1068", {}, {}, false); return false; } else @@ -2334,7 +2336,7 @@ FSTProcessor::valid() const s.step(' '); if(s.size() != 0) { - I18n(LOCALES_DATA).error("LTTB1013", {"side"}, {"left"}, false); + I18n(LOCALES_DATA).error("LTTB1070", {}, {}, false); return false; } } diff --git a/lttoolbox/tmx_compiler.cc b/lttoolbox/tmx_compiler.cc index 49420d7..712102d 100644 --- a/lttoolbox/tmx_compiler.cc +++ b/lttoolbox/tmx_compiler.cc @@ -399,8 +399,9 @@ TMXCompiler::procNode() } else { - I18n(LOCALES_DATA).error("LTTB1028", {"line_number", "element_name"}, - {xmlTextReaderGetParserLineNumber(reader), + I18n(LOCALES_DATA).error("LTTB1028", {"file_name", "line_number", "element_name"}, + {(char*)xmlTextReaderCurrentDoc(reader)->URL, + xmlTextReaderGetParserLineNumber(reader), icu::UnicodeString(name.data())}, true); } }