Merge pull request #1294 from hapifhir/gg-202206-languages

fix bugs in language handling
This commit is contained in:
Grahame Grieve 2023-06-07 22:19:42 +02:00 committed by GitHub
commit 8fea7e3710
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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())) {