public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
        {
            // During project creation, SegmentPairs is only available
            // after Pre-Translate files is called
            // Before that Segment Pairs is empty and only IParagraph units exist
            // TODO: Consider adding a processor for IParagraph units before segmentation

            if (paragraphUnit.IsStructure)
            {
                return;
            }

            foreach (var segPair in paragraphUnit.SegmentPairs)
            {
                var source = segPair.Source;
                foreach (var handler in handlers)
                {
                    source.AcceptVisitor(handler);
                }
            }

            if (settings.ApplyToNonTranslatables)
            {
                var source = paragraphUnit.Source;

                if (source != null)
                {
                    var nonTranslatableHandler = new NonTranslatableHandler(settings, LoadConversionFiles(), reportGenerator);

                    foreach (var item in source)
                    {
                        if (!(item is ISegment))
                        {
                            item.AcceptVisitor(nonTranslatableHandler);
                        }
                    }

                    nonTranslatableHandler.ProcessText();
                }
            }
        }
Пример #2
0
        public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
        {
            if (paragraphUnit.IsStructure)
            {
                return;
            }

            foreach (var segPair in paragraphUnit.SegmentPairs)
            {
                var source = segPair.Source;
                var target = segPair.Target;

                // Convert tags back to text in source
                source.AcceptVisitor(new TargetCleanUpHandler(sourceSettings, ItemFactory, reporter));
                // Convert tags back to text in target
                target.AcceptVisitor(new TargetCleanUpHandler(sourceSettings, ItemFactory, reporter));
                target.AcceptVisitor(new ConversionCleanupHandler(targetSettings, LoadConversionFiles(), ItemFactory, reporter, reportGenerator, BatchTaskMode.Target));
            }

            if (targetSettings.ApplyToNonTranslatables)
            {
                var target = paragraphUnit.Target;

                if (target != null)
                {
                    var nonTranslatableHandler = new NonTranslatableHandler(targetSettings, LoadConversionFiles(), reportGenerator);

                    foreach (var item in target)
                    {
                        if (!(item is ISegment))
                        {
                            item.AcceptVisitor(nonTranslatableHandler);
                        }
                    }

                    nonTranslatableHandler.ProcessText();
                }
            }
        }