public static void SetTargetState(this XElement transUnitElement, TranslationState state) { if (GetTargetState(transUnitElement) == state) { return; } #pragma warning disable IDE0072 // Add missing cases var value = state switch #pragma warning restore IDE0072 // Add missing cases { TranslationState.NeedsReview => NeedsReviewStates.First(), TranslationState.Approved => ApprovedStates.First(), _ => NewState }; SetTargetState(transUnitElement, value); }
public static TranslationState GetTargetState(this XElement transUnitElement) { var targetState = transUnitElement.Element(TargetElement)?.Attribute(StateAttribute)?.Value; if (targetState == null) { return(TranslationState.New); } if (NeedsReviewStates.Contains(targetState)) { return(TranslationState.NeedsReview); } if (ApprovedStates.Contains(targetState)) { return(TranslationState.Approved); } return(TranslationState.New); }