Exporting TMServer paragraph segmented memories to FileBased memories

Hi

We have developed an export process that generates file based memories from tmserver memories. This worked ok in GroupShare 2015. We recently upgraded to 2017 and have been experiencing a few issues with this process.

1. The TranslationMemoryExport class no longer works properly. It produces empty TMX files. Tamás Mészáros created a thread describing this.

2. TMX files produced by the scheduled exporter only seem to emit segtype=sentence, even for our paragraph segmented memories.

3. Copying field definitions throws an invalid cast exception:

   at Sdl.LanguagePlatform.ServerBasedTranslationMemory.Contracts.FieldGroupChangeSet.ToField(FieldEntity fieldEntity)
   at Sdl.LanguagePlatform.ServerBasedTranslationMemory.Contracts.FieldGroupChangeSet.GenerateChangeSet(EntityCollection`1 originalFields, EntityCollection`1 newFields)
   at Sdl.LanguagePlatform.TranslationMemoryApi.AbstractLocalTranslationMemory.SaveFields(FieldDefinitionCollection fields)
   at Sdl.LanguagePlatform.TranslationMemoryApi.AbstractLocalTranslationMemory.Save()

4. We worked around problem 2 using the following code snippet. This does not work for GS2017 however. The API does not expose any LanguageResourceBundles for the TMServer memory. How can we copy the segmentation rules, variables, etc to the new memory?

Thanks

Alan

var mem = new FileBasedTranslationMemory(memory, "", srclang, tgtlang, FuzzyIndexes.SourceWordBased, rec, tok, wc);

var tps = new TranslationProviderServer(new Uri(server), false, un, pw);
var template = tps.GetTranslationMemory(options.Template, TranslationMemoryProperties.All);

mem.LanguageResourceBundles.Clear();
mem.Description = template.Description == null ? "" : template.Description;
mem.Copyright = template.Copyright == null ? "" : template.Copyright;

// throws invalid cast in Save()
mem.FieldDefinitions.AddRange(template.FieldDefinitions);

var tbundle = template.LanguageResourcesTemplate == null ? template.LanguageResourceBundles[srclang]
                                                        
: template.LanguageResourcesTemplate.LanguageResourceBundles[srclang];
// tbundle is null in GS2017!!                                                      
var newbundle = new LanguageResourceBundle(srclang);
if (tbundle.SegmentationRules != null)
   
newbundle.SegmentationRules = new Sdl.LanguagePlatform.Core.Segmentation.SegmentationRules(tbundle.SegmentationRules);
if (tbundle.Variables != null)
   
newbundle.Variables = new Sdl.LanguagePlatform.Core.Wordlist(tbundle.Variables);
if (tbundle.OrdinalFollowers != null)
   
newbundle.OrdinalFollowers = new Sdl.LanguagePlatform.Core.Wordlist(tbundle.OrdinalFollowers);
if (tbundle.Abbreviations != null)
   
newbundle.Abbreviations = new Sdl.LanguagePlatform.Core.Wordlist(tbundle.Abbreviations);
mem.LanguageResourceBundles.Add(newbundle);

// this throws an invalid cast exception in GS2017 if FieldDefinitions are set
mem.Save();
Parents Reply Children
No Data