public void GetAnalyzeTaskSettings(FileBasedProject project) { #region "AnalysisTaskSettings" ISettingsBundle settings = project.GetSettings(); AnalysisTaskSettings analyseSettings = settings.GetSettingsGroup <AnalysisTaskSettings>(); #endregion #region "ReportCrossFileRepetitions" analyseSettings.ReportCrossFileRepetitions.Value = true; #endregion #region "ReportInternalFuzzyMatchLeverage" analyseSettings.ReportInternalFuzzyMatchLeverage.Value = true; #endregion #region "ExportFrequentSettings" analyseSettings.ExportFrequentSegments.Value = true; analyseSettings.FrequentSegmentsNoOfOccurrences.Value = 5; #endregion #region "ExportUnknownSegments" analyseSettings.ExportUnknownSegments.Value = true; analyseSettings.UnknownSegmentsMaximumMatchValue.Value = 50; #endregion #region "UpdateAnalyzeSettings" project.UpdateSettings(settings); #endregion }
public override void PopulateFromSettingsBundle(ISettingsBundle settingsBundle, string fileTypeConfigurationId) { var settingsGroup = settingsBundle.GetSettingsGroup(fileTypeConfigurationId); SourceLineType = GetSettingFromSettingsGroup(settingsGroup, SourceLineTypeSetting, DefaultSourceLineType); IsTargetTextNeeded = GetSettingFromSettingsGroup(settingsGroup, IsTargetTextNeededSetting, DefaultIsTargetTextNeededSetting); }
/// <summary> /// Copies the settings group. /// </summary> /// <param name="sourceSettings">The source settings.</param> /// <param name="targetSettings">The target settings.</param> /// <param name="settingsGroupId">The settings group identifier.</param> /// <param name="targetProject">The target project.</param> /// <param name="targetLanguage">The target language.</param> private void CopySettingsGroup(ISettingsBundle sourceSettings, ISettingsBundle targetSettings, string settingsGroupId, FileBasedProject targetProject, Language targetLanguage) { if (!string.IsNullOrEmpty(settingsGroupId)) { if (targetSettings.ContainsSettingsGroup(settingsGroupId)) { targetSettings.RemoveSettingsGroup(settingsGroupId); } if (sourceSettings.ContainsSettingsGroup(settingsGroupId)) { ISettingsGroup sourceSettingsGroup = sourceSettings.GetSettingsGroup(settingsGroupId); ISettingsGroup targetSettingsGroup = targetSettings.GetSettingsGroup(settingsGroupId); targetSettingsGroup.ImportSettings(sourceSettingsGroup); if (targetLanguage == null) { targetProject.UpdateSettings(targetSettings); } else { targetProject.UpdateSettings(targetLanguage, targetSettings); } } } }
public override void SaveToSettingsBundle(ISettingsBundle settingsBundle, string fileTypeConfigurationId) { var settingsGroup = settingsBundle.GetSettingsGroup(fileTypeConfigurationId); UpdateSettingInSettingsGroup(settingsGroup, SourceLineTypeSetting, SourceLineType, DefaultSourceLineType); UpdateSettingInSettingsGroup(settingsGroup, IsTargetTextNeededSetting, IsTargetTextNeeded, DefaultIsTargetTextNeededSetting); }
public override void SaveToSettingsBundle(ISettingsBundle settingsBundle, string fileTypeConfigurationId) { var settingsGroup = settingsBundle.GetSettingsGroup(fileTypeConfigurationId); UpdateSettingInSettingsGroup(settingsGroup, IsPathFilteringEnabledSetting, IsPathFilteringEnabled, DefaultIsPathFilteringEnabled); _pathRules.SaveToSettingsGroup(settingsGroup, PathRulesSetting); }
/// <summary> /// This method is used to load the setting from the settings bundle, /// which is physically stored in an XML-compliant *.sdlproj or *.sdltpl file. /// </summary> /// <param name="settingsBundle"></param> /// <param name="configurationId"></param> #region "PopulateFromSettingsBundle" public override void PopulateFromSettingsBundle(ISettingsBundle settingsBundle, string configurationId) { ISettingsGroup settingsGroup = settingsBundle.GetSettingsGroup(configurationId); ResetToDefaults(); Enable = GetSettingFromSettingsGroup(settingsGroup, "Enable", Enable); }
/// <summary> /// Configures the analyze task file settings, i.e. in our implementation /// report cross-file repetitions and report the internal fuzzy match leverage. /// </summary> private void GetAnalyzeSettings( FileBasedProject project, string trgLocale, bool reportCrossFileRepetitions, bool reportInternalFuzzyMatchLeverage) #endregion { #region "trgLanguage" Language trgLanguage = new Language(CultureInfo.GetCultureInfo(trgLocale)); #endregion #region "ISettingsBundle" ISettingsBundle settings = project.GetSettings(trgLanguage); AnalysisTaskSettings analyzeSettings = settings.GetSettingsGroup <AnalysisTaskSettings>(); #endregion #region "ConfigureSettings" analyzeSettings.ReportCrossFileRepetitions.Value = reportCrossFileRepetitions; analyzeSettings.ReportInternalFuzzyMatchLeverage.Value = reportInternalFuzzyMatchLeverage; #endregion #region "UpdateSettings" project.UpdateSettings(trgLanguage, settings); #endregion }
public void GetUpdateTmTaskSettings(FileBasedProject project) { #region "UpdateTmTaskSettings" ISettingsBundle settings = project.GetSettings(); TranslationMemoryUpdateTaskSettings updateTmSettings = settings.GetSettingsGroup <TranslationMemoryUpdateTaskSettings>(); #endregion #region "NewTranslations" updateTmSettings.TmImportOptions.Value = TmImportOption.AlwaysAddNewTranslation; #endregion #region "Status" updateTmSettings.UpdateWithApprovedSignOffSegments.Value = true; updateTmSettings.UpdateWithApprovedTranslationSegments.Value = true; updateTmSettings.UpdateWithTranslatedSegments.Value = true; updateTmSettings.UpdateWithDraftSegments.Value = false; updateTmSettings.UpdateWithRejectedSignOffSegments.Value = false; updateTmSettings.UpdateWithRejectedTranslationSegments.Value = false; updateTmSettings.UpdateWithUnspecifiedSegments.Value = false; #endregion #region "UpdateTaskSettings" project.UpdateSettings(settings); #endregion }
/// <summary> /// This method is used to store the settings as configured in the plug-in UI /// in the settings bundle, which means that the settings are physically written /// into the XML-compliant *.sdlproj or *.sdltpl file. /// </summary> /// <param name="settingsBundle"></param> /// <param name="configurationId"></param> #region "SaveToSettingsBundle" public override void SaveToSettingsBundle(ISettingsBundle settingsBundle, string configurationId) { ISettingsGroup settingsGroup = settingsBundle.GetSettingsGroup(configurationId); var defaults = new VerifierSettings(); UpdateSettingInSettingsGroup(settingsGroup, "Enable", Enable, defaults.Enable); }
/// <summary> /// This method is used to store the settings as configured in the plug-in UI /// in the settings bundle, which means that the settings are physically written /// into the XML-compliant *.sdlproj or *.sdltpl file. /// </summary> /// <param name="settingsBundle"></param> /// <param name="configurationId"></param> #region "SaveToSettingsBundle" public override void SaveToSettingsBundle(ISettingsBundle settingsBundle, string filterDefinitionId) { ISettingsGroup settingsGroup = settingsBundle.GetSettingsGroup(filterDefinitionId); UpdateSettingInSettingsGroup(settingsGroup, SettingsLockPrdCodes, LockPrdCodes, DefaultLockPrdCodes); UpdateSettingInSettingsGroup(settingsGroup, SettingsPrdCodesPrefix, PrdCodesPrefix, DefaultPrdCodePrefix); }
public void GetPretranslateTaskSettings(FileBasedProject project) { #region "PetranslateTaskSettings" ISettingsBundle settings = project.GetSettings(); TranslateTaskSettings pretranslateSettings = settings.GetSettingsGroup <TranslateTaskSettings>(); #endregion #region "MinimumScore" pretranslateSettings.MinimumMatchScore.Value = 95; #endregion #region "ExactMatches" pretranslateSettings.ConfirmAfterApplyingExactMatch.Value = true; pretranslateSettings.LockExactMatchSegments.Value = false; #endregion #region "ContextMatches" pretranslateSettings.ConfirmAfterApplyingInContextExactMatch.Value = true; pretranslateSettings.LockContextMatchSegments.Value = true; #endregion #region "NoMatch" pretranslateSettings.NoTranslationMemoryMatchFoundAction.Value = NoTranslationMemoryMatchFoundAction.CopySourceToTarget; #endregion #region "TranslationOverwrite" pretranslateSettings.TranslationOverwriteMode.Value = TranslationUpdateMode.OverwriteExistingTranslation; #endregion #region "UpdateTaskSettings" project.UpdateSettings(settings); #endregion }
/// <summary> /// This method is used to load the setting from the settings bundle, /// which is physically stored in an XML-compliant *.sdlproj or *.sdltpl file. /// </summary> /// <param name="settingsBundle"></param> /// <param name="configurationId"></param> #region "PopulateFromSettingsBundle" public override void PopulateFromSettingsBundle(ISettingsBundle settingsBundle, string filterDefinitionId) { ISettingsGroup settingsGroup = settingsBundle.GetSettingsGroup(filterDefinitionId); LockPrdCodes = GetSettingFromSettingsGroup(settingsGroup, SettingsLockPrdCodes, DefaultLockPrdCodes); PrdCodesPrefix = GetSettingFromSettingsGroup(settingsGroup, SettingsPrdCodesPrefix, DefaultPrdCodePrefix); }
public override void SaveToSettingsBundle(ISettingsBundle settingsBundle, string fileTypeConfigurationId) { var settingsGroup = settingsBundle.GetSettingsGroup(fileTypeConfigurationId); UpdateSettingInSettingsGroup(settingsGroup, SettingRegexEmbeddingEnabled, Enabled, DefaultRegexEmbeddingEnabled); _structureInfos.SaveToSettingsGroup(settingsGroup, SettingStructureInfoList); _matchRules.SaveToSettingsGroup(settingsGroup, SettingMatchRuleList); }
/// <summary> /// This method is used to load the setting from the settings bundle, /// which is physically stored in an XML-compliant *.sdlproj or *.sdltpl file. /// </summary> /// <param name="settingsBundle"></param> /// <param name="configurationId"></param> #region "PopulateFromSettingsBundle" public override void PopulateFromSettingsBundle(ISettingsBundle settingsBundle, string configurationId) { ISettingsGroup settingsGroup = settingsBundle.GetSettingsGroup(configurationId); ResetToDefaults(); CheckWordArt = GetSettingFromSettingsGroup(settingsGroup, nameof(CheckWordArt), CheckWordArt); MaxWordCount = GetSettingFromSettingsGroup(settingsGroup, nameof(MaxWordCount), MaxWordCount); }
/// <summary> /// This method is used to store the settings as configured in the plug-in UI /// in the settings bundle, which means that the settings are physically written /// into the XML-compliant *.sdlproj or *.sdltpl file. /// </summary> /// <param name="settingsBundle"></param> /// <param name="configurationId"></param> #region "SaveToSettingsBundle" public override void SaveToSettingsBundle(ISettingsBundle settingsBundle, string configurationId) { ISettingsGroup settingsGroup = settingsBundle.GetSettingsGroup(configurationId); var defaults = new VerifierSettings(); UpdateSettingInSettingsGroup(settingsGroup, nameof(CheckWordArt), CheckWordArt, defaults.CheckWordArt); UpdateSettingInSettingsGroup(settingsGroup, nameof(MaxWordCount), MaxWordCount, defaults.MaxWordCount); }
/// <summary> /// Use project settings bundle to adapt specific project settings. For more details see Sdl.ProjectAutomation.Settings /// </summary> private void AdaptProjectSettings(FileBasedProject createdProject) { // Adapting translate task settings ISettingsBundle settings = createdProject.GetSettings(); TranslateTaskSettings translateSettings = settings.GetSettingsGroup <TranslateTaskSettings>(); translateSettings.NoTranslationMemoryMatchFoundAction.Value = NoTranslationMemoryMatchFoundAction.CopySourceToTarget; AnalysisTaskSettings analyzeSettings = settings.GetSettingsGroup <AnalysisTaskSettings>(); analyzeSettings.ExportFrequentSegments.Value = true; createdProject.UpdateSettings(settings); // Note the most complicated settings are TranslationMemorySettings, to adapt some part of these you need to use TM API // for example for filters. The documentation should mention this fact and describe how user can get a TM API (link to website) // We should not add such examples into ProjectAutomation API as it would add to many dependencies. }
private static void RunFinetune(FileBasedProject testProject) { ISettingsBundle settings = testProject.GetSettings(); FinetuneBatchTaskSettings finetuneSettings = settings.GetSettingsGroup <FinetuneBatchTaskSettings>(); TranslateTaskSettings pretranslateSettings = settings.GetSettingsGroup <TranslateTaskSettings>(); /*pretranslateSettings.Finetune = true; * pretranslateSettings.ExtractFuzzies = true; * pretranslateSettings.FuzzyMaxResults = 5; * pretranslateSettings.ExtractFillerUnits = true; * pretranslateSettings.FuzzyMinPercentage = 60; * pretranslateSettings.BatchTranslate = false; * pretranslateSettings.AddFiskmoProvider = false; * pretranslateSettings.ExtractConcordanceUnits = true; * pretranslateSettings.MaxFinetuningSentences = 100000; * pretranslateSettings.IncludePlaceholderTags = false; * pretranslateSettings.IncludeTagPairs = false;*/ var finetuneTaskSettingsWindow = new FiskmoTranslationProvider.FinetuneWpfControl(finetuneSettings); Window window = new Window { Title = "Finetune task settings", Content = finetuneTaskSettingsWindow }; window.ShowDialog(); testProject.UpdateSettings(settings); AutomaticTask pretranslateTask = testProject.RunAutomaticTask( testProject.GetTargetLanguageFiles().GetIds(), AutomaticTaskTemplateIds.PreTranslateFiles); AutomaticTask finetuneTask = testProject.RunAutomaticTask( testProject.GetTargetLanguageFiles().GetIds(), "FiskmoBatchTask"); testProject.Save(); }
public override void PopulateFromSettingsBundle(ISettingsBundle settingsBundle, string fileTypeConfigurationId) { var settingsGroup = settingsBundle.GetSettingsGroup(fileTypeConfigurationId); IsPathFilteringEnabled = GetSettingFromSettingsGroup(settingsGroup, IsPathFilteringEnabledSetting, DefaultIsPathFilteringEnabled); if (settingsGroup.ContainsSetting(PathRulesSetting)) { _pathRules.Clear(); _pathRules.PopulateFromSettingsGroup(settingsGroup, PathRulesSetting); } }
public void GetPerfectMatchTaskSettings(FileBasedProject project) { #region "PerfectMatchTaskSettings" ISettingsBundle settings = project.GetSettings(); PerfectMatchTaskSettings perfectMatchSettings = settings.GetSettingsGroup <PerfectMatchTaskSettings>(); #endregion #region "MarkAsPerfectMatchAndLock" perfectMatchSettings.MarkAsPerfectMatchAndLock.Value = true; #endregion #region "UpdateTaskSettings" project.UpdateSettings(settings); #endregion }
public override void PopulateFromSettingsBundle(ISettingsBundle settingsBundle, string fileTypeConfigurationId) { var settingsGroup = settingsBundle.GetSettingsGroup(fileTypeConfigurationId); Enabled = GetSettingFromSettingsGroup(settingsGroup, SettingRegexEmbeddingEnabled, DefaultRegexEmbeddingEnabled); if (settingsGroup.ContainsSetting(SettingStructureInfoList)) { _structureInfos.Clear(); _structureInfos.PopulateFromSettingsGroup(settingsGroup, SettingStructureInfoList); } if (settingsGroup.ContainsSetting(SettingMatchRuleList)) { _matchRules.Clear(); _matchRules.PopulateFromSettingsGroup(settingsGroup, SettingMatchRuleList); } }
public void GetProjectTmTaskSettings(FileBasedProject project) { #region "TaskSettings" ISettingsBundle settings = project.GetSettings(); ProjectTranslationMemoryTaskSettings projectTmSettings = settings.GetSettingsGroup <ProjectTranslationMemoryTaskSettings>(); #endregion #region "ProjectTmSettings" projectTmSettings.CreateServerBasedProjectTranslationMemories.Value = true; projectTmSettings.ServerConnectionUri.Value = string.Empty; projectTmSettings.TranslationMemoryContainerName.Value = "TMCont"; #endregion #region "UpdateTaskSettings" project.UpdateSettings(settings); #endregion }
public void ConfigureBatchTaskSettings(FileBasedProject project, string trgLocale, int minMatchValue) { #region "SetLanguage" Language trgLanguage = new Language(CultureInfo.GetCultureInfo(trgLocale)); #endregion #region "TaskSettings" ISettingsBundle settings = project.GetSettings(trgLanguage); TranslateTaskSettings pretranslateSettings = settings.GetSettingsGroup <TranslateTaskSettings>(); #endregion #region "MinimumMatchScore" pretranslateSettings.MinimumMatchScore.Value = minMatchValue; #endregion #region "UpdateSettings" project.UpdateSettings(trgLanguage, settings); #endregion }
public void GetExportTaskSettings(FileBasedProject project) { #region "ExportTaskSettings" ISettingsBundle settings = project.GetSettings(); ExportFilesSettings exportTaskSettings = settings.GetSettingsGroup <ExportFilesSettings>(); #endregion #region "ExportLocation" exportTaskSettings.ExportLocation.Value = @"c:\temp"; #endregion #region "ExportFileVersion" exportTaskSettings.ExportFileVersion.Value = ExportFileVersion.Bilingual; #endregion #region "UpdateSettings" project.UpdateSettings(settings); #endregion }
private bool CopySettingsGroup(ISettingsBundle sourceSettings, ISettingsBundle targetSettings, string settingsGroupId, FileBasedProject targetProject) { if (string.IsNullOrEmpty(settingsGroupId)) { return(false); } if (!sourceSettings.ContainsSettingsGroup(settingsGroupId)) { return(false); } if (targetSettings.ContainsSettingsGroup(settingsGroupId)) { targetSettings.RemoveSettingsGroup(settingsGroupId); } var sourceSettingsGroup = sourceSettings.GetSettingsGroup(settingsGroupId); var targetSettingsGroup = targetSettings.GetSettingsGroup(settingsGroupId); targetSettingsGroup.ImportSettings(sourceSettingsGroup); targetProject.UpdateSettings(targetSettings); return(true); }
public void ConfigureTmSettings(FileBasedProject project) { #region "GetSettingsBundle" ISettingsBundle settings = project.GetSettings(); TranslationMemorySettings tmSettings = settings.GetSettingsGroup <TranslationMemorySettings>(); #endregion #region "TmSearchSettings" tmSettings.TranslationMinimumMatchValue.Value = 80; tmSettings.TranslationMaximumResults.Value = 10; tmSettings.TranslationFullSearch.Value = true; #endregion #region "ConcordanceSettings" tmSettings.ConcordanceMinimumMatchValue.Value = 30; tmSettings.ConcordanceMaximumResults.Value = 50; #endregion #region "Penalties" tmSettings.MissingFormattingPenalty.Value = 0; tmSettings.DifferentFormattingPenalty.Value = 0; tmSettings.MultipleTranslationsPenalty.Value = 2; #endregion #region "AutoLocalization" tmSettings.NumbersAutoLocalizationEnabled.Value = true; tmSettings.DatesAutoLocalizationEnabled.Value = true; tmSettings.MeasurementsAutoLocalizationEnabled.Value = true; tmSettings.TimesAutoLocalizationEnabled.Value = true; #endregion #region "DatePatterns" tmSettings.ShortDatePattern.Value = "dd.MM.yy"; #endregion #region "FieldUpdate" FieldValues fieldValuesCollection = new FieldValues(); FileBasedTranslationMemory tm = new FileBasedTranslationMemory(@"c:\ProjectFiles\Tms\General En-De.sdltm"); FieldDefinition field = tm.FieldDefinitions["Type"]; FieldValue fv = field.CreateValue(); fv.Name = "Technical documentation"; fieldValuesCollection.Add(fv); tmSettings.ProjectSettings.Value = fieldValuesCollection; #endregion #region "TmFilterPenalty" PicklistItem fieldName = new PicklistItem("Type"); MultiplePicklistFieldValue fieldValue = new MultiplePicklistFieldValue("Technical documentation"); fieldValue.Add(fieldName); AtomicExpression filter = new AtomicExpression(fieldValue, AtomicExpression.Operator.Equal); Filter updateFilter = new Filter(filter, "Filter_name", 1); List <Filter> filterList = new List <Filter>(); filterList.Add(updateFilter); tmSettings.Filters.Value = filterList; #endregion #region "TmHardFilter" PicklistItem hardFilterFieldName = new PicklistItem("Type"); MultiplePicklistFieldValue hardFilterFieldValue = new MultiplePicklistFieldValue("Technical documentation"); hardFilterFieldValue.Add(hardFilterFieldName); AtomicExpression hardFilterExpression = new AtomicExpression(hardFilterFieldValue, AtomicExpression.Operator.Equal); tmSettings.HardFilter.Value = hardFilterExpression; #endregion #region "update" project.UpdateSettings(settings); #endregion }