/// <inheritdoc /> protected override bool ProcessSendTranslationEvent(ISendTranslationTaskEvent evnt, ITranslationJobContext context, out string translationId) { GLExchange projectDirectorClient; if (!context.TryGetItem <GLExchange>(CurrentClientKey, out projectDirectorClient)) { var submissionTicket = evnt.ProjectExternalId; projectDirectorClient = new GLExchange(this.ProjectDirectorConfig); if (!string.IsNullOrEmpty(submissionTicket)) { projectDirectorClient.getSubmission(submissionTicket); } context.Items[CurrentClientKey] = projectDirectorClient; } var translationsComDocument = new Document { fileformat = TranslationsComConnector.FileFormat, // Setting the translation id as the name of the document. name = string.Format("{0}.xlf", evnt.TranslationId), sourceLanguage = evnt.ActualSourceLanguage, targetLanguages = new string[] { evnt.TargetLanguage } }; var xliffFile = evnt.GetXliffFile(); this.ProcessXliffFile(xliffFile); var root = new XliffRoot(); root.Files.Add(xliffFile); var xliffSerializer = new XmlSerializer(typeof(XliffRoot)); using (var xliffStream = new MemoryStream()) { xliffSerializer.Serialize(xliffStream, root); xliffStream.Seek(0, SeekOrigin.Begin); translationsComDocument.setDataFromMemoryStream(xliffStream); projectDirectorClient.uploadTranslatable(translationsComDocument); } // Setting a Boolean value indicating that we successfully uploaded at least one document in the current submission. context.Items[DocumentUploadedKey] = true; translationId = translationsComDocument.name; return(false); }