translationmemory context with GetDuplicateTranslationUnits

Hello Romulus and language developers,

I'm using the languagedirection function GetDuplicateTranslationUnits(ref iterator) to check duplicates in my TM. I would like to work with the respective "context" of each TU but I always get a null array.

            ServerBasedTranslationMemoryLanguageDirection ld...
            DuplicateIterator it = new DuplicateIterator();
            TranslationUnit[] tus = new TranslationUnit[100];
            tus = ld.GetDuplicateTranslationUnits(ref it);
            messageBox(tus[0].Contexts.Length)

How can I get the values that I can see in TMX files like:

      <prop type="x-Context">-1522709460449836151, 1261949811203067737</prop>
      <prop type="x-Context">8590653279671170188, 3118944222861176316</prop>
      <prop type="x-Context">8590653279671170188, 7968670693683955189</prop>
      <prop type="x-Context">9151691339476376339, -6215144725198172964</prop>

Thank you

Sébastien

  • OK, I got it:

    I just have to create a translationunit object with the ID of the tu from iterator. Then, the context appears:

     

               ServerBasedTranslationMemoryLanguageDirection ld...

               DuplicateIterator it = new DuplicateIterator();

               TranslationUnit[] tus = new TranslationUnit[100];

               tus = ld.GetDuplicateTranslationUnits(ref it);

               TranslationUnit tu = ld.GetTranslationUnit(tus[0].ResourceId);

                messageBox.Show(tu.Contexts.Length);

     

    Kind regards

    Sébastien