Hello SDL and Developers,
I need to clear unlocked target segments in sdlxliff when creating a project.
I created a bilingualcontentprocessor (called "Wiper") and I ran it using File Type Framework Apis multifileconverter.
the wiper seems to work as it writes in console for each of its steps, but at the end of the process I get an empty sdlxliff file.
The empty sdlxliff file is well formed but there's no TU in it.
the original SDLxliff file has few tus, 4 of which are unlocked and therefore processed by the wiper.
Where am I doing wrong?
Thank you very much for any incoming suggestion.
This is the Wiper bilingualcontentprocessor
public class Wiper : AbstractBilingualContentProcessor { public override void Initialize(IDocumentProperties documentInfo) { Console.WriteLine("MSG:::Ripulisco il file " + documentInfo.LastOpenedAsPath); base.Initialize(documentInfo); } public override void SetFileProperties(IFileProperties fileInfo) { Console.WriteLine("MSG:::setProp "); base.SetFileProperties(fileInfo); } public override void ProcessParagraphUnit(IParagraphUnit myPu) { if (!myPu.IsStructure) { foreach(var myTu in myPu.SegmentPairs) { if (!myTu.Properties.IsLocked) { Console.WriteLine("Elimino " + myTu.Target.UniqueId.ToString()); myTu.Target.Clear(); } } } } public override void Complete() { Console.WriteLine("MSG:::TuWiper Completo"); base.Complete(); } public override void FileComplete() { Console.WriteLine("MSG:::File Completo"); base.FileComplete(); } }
and i invoke it like that
[....] IFileTypeManager mgr = Sdl.FileTypeSupport.Framework.Core.Utilities.IntegrationApi.DefaultFileTypeManager.CreateInstance(true); string bilingualFilePath = targetFiles[0].LocalFilePath; string outputfile = (targetFiles[0].LocalFilePath+@"new.sdlxliff"); IMultiFileConverter conv = mgr.GetConverterToDefaultBilingual(bilingualFilePath, outputfile, null); conv.AddBilingualProcessor(new Wiper()); conv.Parse(); [...]