private XliffDocument Extract(Bundle xliff, string sourceLanguage, string targetLanguage)
        {
            var document = new XliffDocument(sourceLanguage);

            document.TargetLanguage = targetLanguage;

            var idCounter = new IdCounter();

            foreach (var doc in xliff.Documents)
            {
                var fileId    = "f" + (idCounter.GetNextFileId());
                var xliffFile = new File(fileId);
                xliffFile.Original = doc.SourceIdentifier;

                if (doc.Attributes.Count > 0)
                {
                    xliffFile.Metadata = doc.Attributes.ToXliffMetadata();
                }

                foreach (var container in doc.Containers)
                {
                    var xliffContainer = container.ToXliff(idCounter);
                    xliffFile.Containers.Add(xliffContainer);
                }

                document.Files.Add(xliffFile);
            }
            return(document);
        }
Beispiel #2
0
        private XliffDocument Extract(Bundle xliff, string sourceLanguage, string targetLanguage)
        {
            var document = new XliffDocument(sourceLanguage);

            document.TargetLanguage = targetLanguage;

            var idCounter = new IdCounter();

            foreach (var doc in xliff.Documents)
            {
                document.Files.Add(doc.ToXliff(idCounter) as File);
            }
            return(document);
        }