protected override void Execute() { // set the default settings for creating the xliff from the sdlxliff // these should not be taken from the users settings var settings = GetSettings(); settings.ExportOptions.CopySourceToTarget = false; settings.ExportOptions.IncludeTranslations = true; settings.ExportOptions.ExcludeFilterIds = new List <string>(); settings.ImportOptions.StatusTranslationUpdatedId = "Translated"; settings.ImportOptions.StatusSegmentNotImportedId = string.Empty; settings.ImportOptions.StatusTranslationNotUpdatedId = string.Empty; settings.ImportOptions.OverwriteTranslations = true; var action = Enumerators.Action.Convert; var workFlow = Enumerators.WorkFlow.Internal; var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider, _imageService, _controllers, _segmentBuilder, settings, _dialogService, _projectAutomationService); var taskContext = wizardService.ShowWizard(_controllers.ProjectsController, out var message); if (taskContext == null && !string.IsNullOrEmpty(message)) { MessageBox.Show(message, PluginResources.Plugin_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } _controllers.TranscreateController.UpdateProjectData(taskContext); }
protected override void Execute() { var selectedProject = _controllers.TranscreateController.GetSelectedProjects()?.FirstOrDefault(); if (selectedProject == null) { return; } var documents = _controllers.EditorController.GetDocuments()?.ToList(); if (documents != null && documents.Count > 0) { var documentProjectIds = documents.Select(a => a.Project.GetProjectInfo().Id.ToString()).Distinct(); if (documentProjectIds.Any(a => a == selectedProject.Id)) { MessageBox.Show(PluginResources.Wanring_Message_CloseAllProjectDocumentBeforeProceeding, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } } var action = selectedProject is BackTranslationProject ? Enumerators.Action.ExportBackTranslation : Enumerators.Action.Export; var workFlow = Enumerators.WorkFlow.External; var settings = GetSettings(); var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider, _imageService, _controllers, _segmentBuilder, settings, _dialogService, _projectAutomationService, _projectSettingsService); var taskContext = wizardService.ShowWizard(Controller, out var message); if (taskContext == null && !string.IsNullOrEmpty(message)) { MessageBox.Show(message, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } if (selectedProject is BackTranslationProject) { var projects = _controllers.TranscreateController.GetProjects(); var parentProject = projects.FirstOrDefault(project => project.BackTranslationProjects.Exists(a => a.Id == selectedProject.Id)); _controllers.TranscreateController.UpdateBackTranslationProjectData(parentProject?.Id, taskContext); } else { _controllers.TranscreateController.UpdateProjectData(taskContext); } }
protected override void Execute() { var wizardService = new WizardService(Enumerators.Action.Export, _pathInfo, _customerProvider, _imageService, _controllers, _segmentBuilder, GetSettings(), _dialogService, _languageProvider); var wizardContext = wizardService.ShowWizard(_controllers.FilesController, out var message); if (wizardContext == null && !string.IsNullOrEmpty(message)) { MessageBox.Show(message, PluginResources.XLIFFManager_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } _controllers.XliffManagerController.UpdateProjectData(wizardContext); }
protected override void Execute() { //if (!_controllers.TranscreateController.IsActive) //{ // return; //} var selectedProject = _controllers.TranscreateController.GetSelectedProjects()?.FirstOrDefault(); if (selectedProject == null) { return; } var action = selectedProject is BackTranslationProject ? Enumerators.Action.ImportBackTranslation : Enumerators.Action.Import; var workFlow = Enumerators.WorkFlow.External; var settings = GetSettings(); var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider, _imageService, _controllers, _segmentBuilder, settings, _dialogService, _projectAutomationService); var taskContext = wizardService.ShowWizard(_controllers.TranscreateController, out var message); if (taskContext == null && !string.IsNullOrEmpty(message)) { MessageBox.Show(message, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } if (selectedProject is BackTranslationProject) { var projects = _controllers.TranscreateController.GetProjects(); var parentProject = projects.FirstOrDefault(project => project.BackTranslationProjects.Exists(a => a.Id == selectedProject.Id)); _controllers.TranscreateController.UpdateBackTranslationProjectData(parentProject, taskContext); } else { _controllers.TranscreateController.UpdateProjectData(taskContext); } }
protected override void Execute() { var projects = _controllers.TranscreateController.GetSelectedProjects(); if (projects?.Count != 1) { Enabled = false; return; } var project = projects[0]; if (project is BackTranslationProject) { return; } var studioProject = _controllers.ProjectsController.GetProjects() .FirstOrDefault(a => a.GetProjectInfo().Id.ToString() == project.Id); if (studioProject == null) { return; } var documents = _controllers.EditorController.GetDocuments()?.ToList(); if (documents != null && documents.Count > 0) { var documentProjectIds = documents.Select(a => a.Project.GetProjectInfo().Id.ToString()).Distinct(); if (documentProjectIds.Any(a => a == project.Id)) { MessageBox.Show(PluginResources.Wanring_Message_CloseAllProjectDocumentBeforeProceeding, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } } var action = Enumerators.Action.CreateBackTranslation; var workFlow = Enumerators.WorkFlow.Internal; var settings = GetSettings(); settings.ExportOptions.IncludeBackTranslations = true; settings.ExportOptions.IncludeTranslations = true; settings.ExportOptions.CopySourceToTarget = false; settings.ImportOptions.OverwriteTranslations = true; settings.ImportOptions.OriginSystem = Constants.OriginSystem_TranscreateAutomation; settings.ImportOptions.StatusTranslationUpdatedId = string.Empty; var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider, _imageService, _controllers, _segmentBuilder, settings, _dialogService, _projectAutomationService, _projectSettingsService); try { _controllers.TranscreateController.IgnoreProjectChanged = true; var taskContext = wizardService.ShowWizard(Controller, out var message); if (taskContext == null && !string.IsNullOrEmpty(message)) { LogManager.GetCurrentClassLogger().Warn(message); MessageBox.Show(message, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { LogManager.GetCurrentClassLogger().Error(ex); MessageBox.Show(ex.Message, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information); } finally { _controllers.TranscreateController.IgnoreProjectChanged = false; } }
protected override void Execute() { var selectedProject = _controllers.ProjectsController.SelectedProjects.FirstOrDefault(); if (selectedProject == null) { return; } var documents = _controllers.EditorController.GetDocuments()?.ToList(); if (documents != null && documents.Count > 0) { var documentProjectIds = documents.Select(a => a.Project.GetProjectInfo().Id.ToString()).Distinct(); if (documentProjectIds.Any(a => a == selectedProject.GetProjectInfo().Id.ToString())) { MessageBox.Show(PluginResources.Wanring_Message_CloseAllProjectDocumentBeforeProceeding, PluginResources.TranscreateManager_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } } // set the default settings for creating the xliff from the sdlxliff // these should not be taken from the users settings var settings = GetSettings(); settings.ExportOptions.CopySourceToTarget = false; settings.ExportOptions.IncludeTranslations = true; settings.ExportOptions.ExcludeFilterIds = new List <string>(); settings.ImportOptions.StatusTranslationUpdatedId = string.Empty; settings.ImportOptions.StatusSegmentNotImportedId = string.Empty; settings.ImportOptions.StatusTranslationNotUpdatedId = string.Empty; settings.ImportOptions.OverwriteTranslations = true; var action = Enumerators.Action.Convert; var workFlow = Enumerators.WorkFlow.Internal; var newProjectLocalFolder = selectedProject.GetProjectInfo().LocalProjectFolder + "-T"; if (Directory.Exists(newProjectLocalFolder)) { MessageBox.Show(PluginResources.Warning_Message_ProjectFolderAlreadyExists + Environment.NewLine + Environment.NewLine + newProjectLocalFolder, PluginResources.Plugin_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } if (selectedProject.GetProjectInfo().ProjectOrigin == Constants.ProjectOrigin_TranscreateProject) { MessageBox.Show(PluginResources.Warning_Message_ProjectAlreadyTranscreateProject, PluginResources.Plugin_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } var wizardService = new WizardService(action, workFlow, _pathInfo, _customerProvider, _imageService, _controllers, _segmentBuilder, settings, _dialogService, _projectAutomationService, _projectSettingsService); var taskContext = wizardService.ShowWizard(_controllers.ProjectsController, out var message); if (taskContext == null && !string.IsNullOrEmpty(message)) { MessageBox.Show(message, PluginResources.Plugin_Name, MessageBoxButton.OK, MessageBoxImage.Information); return; } _controllers.TranscreateController.UpdateProjectData(taskContext); }