예제 #1
0
 public ImportStudioTmStep(TranslationMemoryReference outputTranslationMemory, string name, TmxFile tmxFile)
     : base(String.Format("Import {0}", name))
 {
     _outputTranslationMemory = outputTranslationMemory;
     _name    = name;
     _tmxFile = tmxFile;
 }
예제 #2
0
        private 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;
            }
        }
예제 #3
0
 public ImportStudioTmStep(TranslationMemoryReference outputTranslationMemory, string name, TmxFile tmxFile)
     : base(String.Format("Import {0}", name))
 {
     _outputTranslationMemory = outputTranslationMemory;
     _name = name;
     _tmxFile = tmxFile;
 }
예제 #4
0
 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;
 }
예제 #5
0
 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;
 }
예제 #6
0
 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;
 }
예제 #7
0
 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;
 }
예제 #8
0
        private 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;
            }
        }