Skip to content

Commit

Permalink
XLIFF: format empty translation as <target></target>
Browse files Browse the repository at this point in the history
Change the code to output empty translations as <target></target>
instead of <target/> because the latter is unexpected and possibly
non-conformant.
  • Loading branch information
vslavik committed Sep 26, 2024
1 parent b0b17b4 commit ed330ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/catalog_xliff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,9 @@ class XLIFF12CatalogItem : public XLIFFCatalogItem
else // no translation
{
remove_all_children(target);
// Ensure the node is shown as <target></target> rather than <target/>.
// The spec is unclear in this regard and the former is more expected.
target.text() = "";
}

Impl_UpdateTargetState(target, !trans.empty(), m_isFuzzy);
Expand Down Expand Up @@ -821,6 +824,9 @@ class XLIFF2CatalogItem : public XLIFFCatalogItem
m_node.remove_attribute("state");
m_node.remove_attribute("subState");
remove_all_children(target);
// Ensure the node is shown as <target></target> rather than <target/>.
// The spec is unclear in this regard and the former is more expected.
target.text() = "";
}
}

Expand Down

0 comments on commit ed330ee

Please sign in to comment.