/// <summary> /// When all but the last part of the id changed, this can help reunite things /// </summary> internal XLiffTransUnit GetTransUnitForOrphan(XLiffTransUnit orphan) { var terminalIdToMatch = XLiffLocalizedStringCache.GetTerminalIdPart(orphan.Id); var defaultTextToMatch = GetDefaultVariantValue(orphan); return(_transUnits.FirstOrDefault(tu => XLiffLocalizedStringCache.GetTerminalIdPart(tu.Id) == terminalIdToMatch && GetDefaultVariantValue(tu) == defaultTextToMatch)); }
/// <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 }
/// ------------------------------------------------------------------------------------ internal XLiffTransUnitUpdater(XLiffLocalizedStringCache cache) { _stringCache = cache; _defaultLang = LocalizationManager.kDefaultLang; var replacement = _stringCache.GetDocument(_defaultLang).File .HardLineBreakReplacement; if (replacement != null) { _literalNewline = replacement; } }