fix bugs in language handling

This commit is contained in:
Grahame Grieve 2023-06-07 21:31:25 +02:00
parent 9b9e50e0be
commit 8c412d78ef
2 changed files with 5 additions and 1 deletions

View File

@ -118,6 +118,10 @@ public class PoGetTextProducer extends LanguageFileProducer {
}
} else if (s.startsWith("#:")) {
tu = new TranslationUnit(lang, s.substring(2).trim(), null, null, null);
} else if (s.startsWith("#.")) {
if (tu != null) {
tu.setContext(s.substring(2).trim());
}
} else {
throw new IOException("Encountered unexpected line '"+s+"'");
}

View File

@ -115,7 +115,7 @@ public class XLIFFProducer extends LanguageFileProducer {
Element body = XMLUtil.getNamedChild(file, "body");
for (Element transUnit : XMLUtil.getNamedChildren(body, "trans-unit")) {
Element notes = XMLUtil.getNamedChild(transUnit, "notes");
TranslationUnit tu = new TranslationUnit(file.getAttribute("target-language"), transUnit.getAttribute("id"),
TranslationUnit tu = new TranslationUnit(file.getAttribute("target-language"), transUnit.getAttribute("resname"),
notes == null ? null : XMLUtil.getNamedChildText(notes, "note"),
XMLUtil.getNamedChildText(transUnit, "source"), XMLUtil.getNamedChildText(transUnit, "target"));
if (!Utilities.noString(tu.getSrcText()) && !Utilities.noString(tu.getTgtText())) {