/// <summary> /// Sets the field value in the translation unit. /// </summary> /// <param name="translationMemoryMatch">The translation memory match.</param> /// <param name="translationUnit">The translation unit to applied the value to.</param> protected void SetSystemFieldsValues(ITmMatch translationMemoryMatch, TranslationUnit translationUnit) { translationUnit.SystemFields.ChangeDate = translationMemoryMatch.TranslationUnitFields.ChangeDate; translationUnit.SystemFields.ChangeUser = translationMemoryMatch.TranslationUnitFields.ChangeUser; translationUnit.SystemFields.CreationDate = translationMemoryMatch.TranslationUnitFields.CreationDate; translationUnit.SystemFields.CreationUser = translationMemoryMatch.TranslationUnitFields.CreationUser; translationUnit.SystemFields.UseCount = translationMemoryMatch.TranslationUnitFields.UsageCounter; translationUnit.SystemFields.UseDate = translationMemoryMatch.TranslationUnitFields.UsedDate; //// translationUnit.SystemFields.UseUser = translationMemoryMatch.TranslationUnitFields //// Note: last used user is not stored }
/// <summary> /// Applies the penalties from the match. /// </summary> /// <param name="translationMemoryMatch">The translation memory match.</param> /// <param name="scoringResult">The scoring result.</param> /// <param name="settings">The settings.</param> protected void ApplyPenalties(ITmMatch translationMemoryMatch, ScoringResult scoringResult, SearchSettings settings) { scoringResult.CheckForZeroAndApply(new Penalty(PenaltyType.FilterPenalty, translationMemoryMatch.ScoreValues.TextFieldMismatchPenalty + translationMemoryMatch.ScoreValues.AttributeMismatchPenalty)); // this can be applied twice, see Penalty.CanApplyMultipleTimes method scoringResult.CheckForZeroAndApply(new Penalty(PenaltyType.TagMismatch, translationMemoryMatch.ScoreValues.FormattingMismatchPenalty)); scoringResult.CheckForZeroAndApply(new Penalty(PenaltyType.TagMismatch, translationMemoryMatch.ScoreValues.PlaceableMismatchPenalty)); scoringResult.CheckForZeroAndApply(new Penalty(PenaltyType.MultipleTranslations, translationMemoryMatch.ScoreValues.MultipleTranslationsPenalty)); }