Store metadata per segment (SetMetaData)

Hi,

I would like to store some metadata in a project per segment (e.g. an additional identifier). For example, for segment 10, this would look like: ActiveDocument.SegmentPairs.ElementAt(10).Target.Properties.TranslationOrigin.SetMetaData("MyKey", "Meta data information");


This used to work in the past. However, after doing this on a Japanese translation segment, it does not seem to work anymore. After executing this code, "MyKey" is not added.

However, in the debugger, when I invoke this method, the item is added to MetaData.

Does anyone has a clue?

Are there other (better) ways to store information at a segment?

Best regards,
Henk
Parents Reply
  • Hi Romulus,
    Thanks for this response. The problem is not that the ActiveDocument is null. It has a valid pointer and I can access all document information and have access to the 2 files that are opened.

    The _currentfileid is the ID (Guid) of the ActiveFile (obtained via ActiveDocument.ActiveFile.Id). In the code snippet above, instead of a parameter, I could have used the assignment _currentfileid = ActiveDocument.ActiveFile.Id

    The method visits each segmentpair in the ActiveDocument. If the code finds the segment-ID for that particular file, then it should assign the meta data. However, this assignment only works for the first file, not for the second. It looks like the assignment is done on a clone of the object.

    Please let me know if you need more details.
    -Henk
Children