Index: translate/storage/poxliff.py
===================================================================
--- translate/storage/poxliff.py (revision 7897)
+++ translate/storage/poxliff.py (working copy)
@@ -251,7 +251,34 @@
def hasplural(self):
return self.xmlelement.tag == self.namespaced("group")
+ def getcontext_message(self):
+ """Returns the message context for this unit, if any.
+ This message context is intended to identify the message that
+ represents the PO msgctxt.
+ See http://bugs.locamotion.org/show_bug.cgi?id=258 for details.
+ """
+ groups = self.getcontextgroups("po-msgctxt")
+ context = ""
+ if groups:
+ # groups = [[(context-type, context_message)]]
+ context = groups[0][0][1]
+ return context
+
+ def setcontext_message(self, context):
+ """Sets the message context for this unit.
+ The message context will be set as the message which represents the
+ PO msgctxt in XLIFF.
+ See http://bugs.locamotion.org/show_bug.cgi?id=258 for details.
+ """
+ group_name = "po-msgctxt"
+ if self.getcontext_message():
+ self.delcontextgroup(group_name)
+
+ self.createcontextgroup(group_name, [("x-po-msgctxt", context)],
+ purpose="match information")
+
+
class PoXliffFile(xliff.xlifffile, poheader.poheader):
"""a file for the po variant of Xliff files"""
UnitClass = PoXliffUnit