/// <summary> /// When all but the last part of the id changed, this can help reunite things /// </summary> internal XLiffTransUnit GetTransUnitForOrphan(XLiffTransUnit orphan, XLiffBody source) { var terminalIdToMatch = XLiffLocalizedStringCache.GetTerminalIdPart(orphan.Id); var defaultTextToMatch = GetDefaultVariantValue(orphan); return(TransUnitsUnordered.FirstOrDefault(tu => XLiffLocalizedStringCache.GetTerminalIdPart(tu.Id) == terminalIdToMatch && // require last part of ID to match GetDefaultVariantValue(tu) == defaultTextToMatch && // require text to match source?.GetTransUnitForId(tu.Id) == null)); // and translation does not already have an element for this }
/// <summary> /// When we change ids after people have already been localizing, we have a BIG PROBLEM. /// This helps with the common case were we just changed the hierarchical organization of the id, /// that is, the parts of the id before th final '.'. /// If provided with the source document of the possible orphan, will not answer one that /// has an ID matching something in that. (This argument should always be supplied, but /// for backwards compatibility we allow it to be omitted.) /// </summary> public XLiffTransUnit GetTransUnitForOrphan(XLiffTransUnit orphan, XLiffBody source = null) { return(File.Body.GetTransUnitForOrphan(orphan, source)); }
public ListWrapper(IEnumerable <XLiffTransUnit> startWith, XLiffBody body) { _list = startWith; _body = body; }