public void CreateProcessingSteps() { ProcessingSteps.Clear(); ProcessingContext context = new ProcessingContext(); context.Settings = Settings; InputTmxFile existingTmtmxFile = null; if (Mode == WizardMode.CleanExistingTranslationMemory) { existingTmtmxFile = new InputTmxFile(new TmxFile(context.GetTempTmxFile())); existingTmtmxFile.CleanTmxFile = new TmxFile(context.GetTempTmxFile()); // export TM ProcessingSteps.Add(new ExportStudioTmStep(InputTranslationMemory.TranslationMemory, existingTmtmxFile.TmxFile)); // strip workbench TUs ProcessingSteps.Add(new StripWorkbenchTusStep(InputTranslationMemory.TranslationMemory.Name, existingTmtmxFile.TmxFile, existingTmtmxFile.CleanTmxFile)); } foreach (InputTmxFile inputTmxFile in InputTmxFiles) { // clean TMX inputTmxFile.CleanTmxFile = new TmxFile(context.GetTempTmxFile()); ProcessingSteps.Add(new CleanWorkbenchTmxStep(inputTmxFile.TmxFile, inputTmxFile.CleanTmxFile, null)); } TranslationMemoryReference outputTranslationMemory; if (OutputMethod == OutputMethod.CreateNewTranslationMemory) { outputTranslationMemory = new TranslationMemoryReference { FilePath = NewOutputTranslationMemoryFilePath }; // create output TM ProcessingSteps.Add(new CreateStudioTmStep(outputTranslationMemory, SourceLanguage, TargetLanguage, InputTranslationMemory)); } else { outputTranslationMemory = OutputTranslationMemory; } foreach (InputTmxFile inputTmxFile in InputTmxFiles) { // import clean TMX ProcessingSteps.Add(new ImportStudioTmStep(outputTranslationMemory, Path.GetFileName(inputTmxFile.TmxFile.FilePath), inputTmxFile.CleanTmxFile)); } if (existingTmtmxFile != null) { ProcessingSteps.Add(new ImportStudioTmStep(outputTranslationMemory, Path.GetFileName(InputTranslationMemory.FilePath), existingTmtmxFile.CleanTmxFile)); } ProcessingSteps.Add(new DeleteTempFilesStep()); // set context of all steps foreach (ProcessingStep step in ProcessingSteps) { step.Context = context; } }
public ImportStudioTmStep(TranslationMemoryReference outputTranslationMemory, string name, TmxFile tmxFile) : base(String.Format("Import {0}", name)) { _outputTranslationMemory = outputTranslationMemory; _name = name; _tmxFile = tmxFile; }
public CreateStudioTmStep( TranslationMemoryReference tm, Language sourceLanguage, Language targetLanguage, TranslationMemoryReference templateTranslationMemory) : base(String.Format("Create output TM {0}", Path.GetFileName(tm.FilePath))) { _tm = tm; _sourceLanguage = sourceLanguage; _targetLanguage = targetLanguage; _templateTranslationMemory = templateTranslationMemory; }
public TMCleanerViewModel() { InputTmxFiles = new ObservableCollection <InputTmxFile>(); Mode = WizardMode.ConvertTranslationMemory; OutputMethod = OutputMethod.CreateNewTranslationMemory; InputTranslationMemory = new TranslationMemoryReference(); OutputTranslationMemory = new TranslationMemoryReference(); ProcessingSteps = new ObservableCollection <ProcessingStep>(); Settings = new Settings(); ProcessingState = ProcessingState.NotProcessing; CanFinish = false; }