コード例 #1
0
ファイル: XLiffBody.cs プロジェクト: phillip-hopper/l10nsharp
        /// <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));
        }
コード例 #2
0
        /// <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
        }
コード例 #3
0
        /// ------------------------------------------------------------------------------------
        internal XLiffTransUnitUpdater(XLiffLocalizedStringCache cache)
        {
            _stringCache = cache;
            _defaultLang = LocalizationManager.kDefaultLang;
            var replacement = _stringCache.GetDocument(_defaultLang).File
                              .HardLineBreakReplacement;

            if (replacement != null)
            {
                _literalNewline = replacement;
            }
        }