using System.IO; namespace UnityEditor.Localization.Plugins.XLIFF.Common { /// /// The root element of an XLIFF document is <xliff>. /// It contains a collection of <file> elements. Typically, each <file> element contains a /// set of <unit> elements that contain the text to be translated in the <source> /// child of one or more <segment> elements. /// Translations are stored in the <target> child of each <segment> element. /// public interface IXliffDocument { /// /// The XLIFF version. /// string Version { get; } /// /// The language that was translated from to /// string SourceLanguage { get; set; } /// /// The language that was translated to from . /// string TargetLanguage { get; set; } /// /// The number of files in the document. /// int FileCount { get; } /// /// Returns the file for the requested index. /// /// The file index. /// The requested file of null if one does not exist. IFile GetFile(int index); /// /// Adds a new file to the document. /// /// void AddFile(IFile f); /// /// Remove the files from the document. /// /// void RemoveFile(IFile f); /// /// Add a new files to the document and returns it. /// /// The new file. IFile AddNewFile(); /// /// Serialize the document into XLIFF. /// /// void Serialize(Stream stream); } /// /// The target of the note. /// public enum NoteType { /// /// General note that applies to the whole entry. /// General, /// /// Note that only applies to the source language. /// Source, /// /// Note that only applies to the target language. /// Target } /// /// Readable comments and annotations. /// public interface INote { /// /// The target of the note. /// NoteType AppliesTo { get; set; } /// /// The contents of the note. /// string NoteText { get; set; } } /// /// Holds a collection of . /// public interface INoteCollection { /// /// Returns the number of notes in the collection. /// int NoteCount { get; } /// /// Returns the note for the requested index. /// /// The note index. /// The requested note or if one does not exist. INote GetNote(int index); /// /// Adds a note to the collection. /// /// The note to add. void AddNote(INote note); /// /// Removes the note from the collection. /// /// The note to be removed. void RemoveNote(INote note); /// /// Add a new note to the collection and returns it. /// /// The new note. INote AddNewNote(); } /// /// Container for localization material extracted from an entire single document, or another high-level, /// self-contained logical node in a content structure that cannot be described in the terms of documents. /// public interface IFile : IGroupCollection, ITranslationUnitCollection, INoteCollection { /// /// The Id of the original document. /// By default this is the asset guid. /// string Id { get; set; } /// /// The location of the original document from which the content of the enclosing elements are extracted. /// By default this is the path. /// string Original { get; set; } } /// /// Static container for a dynamic structure of elements holding the extracted translatable source text, aligned with the translated text. /// public interface ITranslationUnit : INoteCollection { /// /// The unique Id of the translation unit. By default this is the . /// string Id { get; set; } /// /// The unique name of the translation unit. By default this is the . /// string Name { get; set; } /// /// The source text taken from the for the source . /// string Source { get; set; } /// /// The target text taken from the for the source . /// string Target { get; set; } } /// /// Holds a collection of . /// public interface ITranslationUnitCollection { /// /// The number of translation units in the collection. /// int TranslationUnitCount { get; } /// /// Returns the translation unit for the selected index. /// /// The index of the translation unit to return. /// The translation unit or if one does not exist for the selected index. ITranslationUnit GetTranslationUnit(int index); /// /// Adds the translation unit to the collection. /// /// The translation unit to add to the collection. void AddTranslationUnit(ITranslationUnit tu); /// /// Removes the translation unit from the collection. /// /// void RemoveTranslationUnit(ITranslationUnit tu); /// /// Adds a new translation unit to the collection and returns it. /// /// The newly created translation unit. ITranslationUnit AddNewTranslationUnit(); } /// /// Provides a way to organize units into a structured hierarchy. /// public interface IGroup : IGroupCollection, INoteCollection, ITranslationUnitCollection { /// /// The unique Id of the group. By default this is mapped to the . /// string Id { get; set; } /// /// The unique name of the group. By default this is mapped to the . /// string Name { get; set; } } /// /// Holds a collection of . /// public interface IGroupCollection { /// /// Returns the number of groups in the collection. /// int GroupCount { get; } /// /// Returns the group for the index. /// /// The index of the group to return. /// The requested group or if one does not exist. IGroup GetGroup(int index); /// /// Adds the group to the collection. /// /// The group to add to the collection. void AddGroup(IGroup grp); /// /// Removes the group from the collection. /// /// The group to remove. void RemoveGroup(IGroup grp); /// /// Adds a new group to the collection and returns it. /// /// The newly created group. IGroup AddNewGroup(); } }