Search Results for

    Show / Hide Table of Contents

    Interface IMultiFileConverter

    Used for converting and processing content from one or more files as a single bilingual document.

    Inherited Members
    IBilingualProcessorContainer.AddBilingualProcessor(IBilingualContentProcessor)
    IBilingualProcessorContainer.InsertBilingualProcessor(Int32, IBilingualContentProcessor)
    IBilingualProcessorContainer.RemoveBilingualProcessor(IBilingualContentProcessor)
    IBilingualProcessorContainer.GetBilingualProcessors()
    IBilingualProcessorContainer.FileRestriction
    IBilingualProcessorContainer.ParagraphUnitRestriction
    Namespace: Sdl.FileTypeSupport.Framework.IntegrationApi
    Assembly: Sdl.FileTypeSupport.Framework.Core.dll
    Syntax
    public interface IMultiFileConverter : IBilingualProcessorContainer

    Properties

    BilingualDocumentGenerator

    The purpose of a bilingual generator is to serialize all bilingual content (potentially from different native files) into a single bilingual output (e.g. an XLIFF file) that will act as a persistent storage for the bilingual content, from which it can be fully de-serialized.

    Declaration
    IBilingualDocumentGenerator BilingualDocumentGenerator { get; set; }
    Property Value
    Type Description
    IBilingualDocumentGenerator
    Remarks

    If set, the input of the bilingual generator is used as the last bilingual content processor.

    When a bilingual generator is specified, the NativeGeneratorProvider and OutputPropertiesProvider are not used, even if they are set.

    Set this to null if you are not writing to an intermediate bilingual file format.

    When set, the BilingualDocumentOutputPropertiesProvider is used.

    BilingualDocumentOutputProperties

    After saving a bilingual document, this property provides access to the output properties that were used. This can be used to find the file name of the created output file and to determine which dependency files are referenced (linked) to the file rather than embedded inside the file.

    Declaration
    IBilingualDocumentOutputProperties BilingualDocumentOutputProperties { get; }
    Property Value
    Type Description
    IBilingualDocumentOutputProperties

    BilingualDocumentOutputPropertiesProvider

    When writing bilingual document files (e.g. SDL XLIFF), this property must be set. The delegate is called by the converter to determine the file name of the bilingual document to be created.

    Declaration
    BilingualDocumentOutputPropertiesProvider BilingualDocumentOutputPropertiesProvider { get; set; }
    Property Value
    Type Description
    BilingualDocumentOutputPropertiesProvider

    BilingualVerifiersProvider

    In order to add the file specific verifiers into the processing chain, we can specify a BilingualVerifiersProvider. A default implementation is provided by the FileTypeManager. If no bilingual verification is required, this property should be left null.

    Declaration
    BilingualVerifiersProvider BilingualVerifiersProvider { get; set; }
    Property Value
    Type Description
    BilingualVerifiersProvider

    DependencyFileLocator

    When parsing intermediate bilingual documents this property may be set to provide assistance in locating missing linked dependency files. The provided delegate will be passed to any bilingual document parsers before they are used for processing.

    Declaration
    DependencyFileLocator DependencyFileLocator { get; set; }
    Property Value
    Type Description
    DependencyFileLocator
    Remarks

    If not provided, and a dependency file cannot be located, a warning message the parser may still attempt to process the file, but it is recommended to generate a warning message.

    DetectedLanguagesCorrespondToDocumentProperties

    True if the source and target languages in the DocumentInfo correspond to the languages detected by the file sniffers for each of the extractors. False if any of the extractors is certain that its file is using a different source or target language.

    Declaration
    bool DetectedLanguagesCorrespondToDocumentProperties { get; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    The method UpdateDocumentPropertiesFromExtractors() can be called to set the current document properties from the detected languages. However, if there are multiple extractors that detect with certainty different languages, this will not work.

    You can ensure that specific languages get applied to all extractors by updating the document properties and by calling ApplyDocumentPropertiesToExtractors().

    The DetectedSourceLanguage and DetectedTargetLanguage properties can be used to retrieve the source and target language detected by the extractors if a common language is detected and can be used. You can also access the detected source and target languages explicitly for each extractor by looking at FileConversionProperties and checking the FileSnifferInfo.

    DetectedSourceLanguage

    The source language for all extractors, or null if conflicting source languages have been determined with certainty. The detection level that is returned is the highest detection level for the source language provided by the extractors.

    Declaration
    Pair<Language, DetectionLevel> DetectedSourceLanguage { get; }
    Property Value
    Type Description
    Pair<Language, DetectionLevel>
    Remarks

    You can also access the detected source and target languages explicitly for each extractor by looking at SniffInfo in the FileConversionProperties.

    See Also
    DetectedLanguagesCorrespondToDocumentProperties
    DetectedTargetLanguage
    UpdateDocumentPropertiesFromExtractors()
    ApplyDocumentPropertiesToExtractors()

    DetectedTargetLanguage

    The target language for all extractors, or null if conflicting target languages have been determined with certainty. The detection level that is returned is the highest detection level for the target language provided by the extractors.

    Declaration
    Pair<Language, DetectionLevel> DetectedTargetLanguage { get; }
    Property Value
    Type Description
    Pair<Language, DetectionLevel>
    Remarks

    You can also access the detected source and target languages explicitly for each extractor by looking at SniffInfo in the FileConversionProperties.

    See Also
    DetectedLanguagesCorrespondToDocumentProperties
    DetectedTargetLanguage
    UpdateDocumentPropertiesFromExtractors()
    ApplyDocumentPropertiesToExtractors()

    DocumentInfo

    Common properties communicated to all bilingual processing components

    Declaration
    IDocumentProperties DocumentInfo { get; }
    Property Value
    Type Description
    IDocumentProperties
    Remarks

    Note that changing the document properties by accessing this property will not automatically update language settings for any of the extractors. Call SetDocumentInfo(IDocumentProperties, Boolean) or ApplyDocumentPropertiesToExtractors() to do that.

    Extractors

    Read-only access to the file extractors used for reading files.

    Declaration
    IEnumerable<IFileExtractor> Extractors { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<IFileExtractor>
    Remarks

    The order of the extractors reflects the order in which they will be used.

    You must use AddExtractor(IFileExtractor) and RemoveExtractor(IFileExtractor) if you want to modify the collection.

    ItemFactory

    The bilingual content model item factory that will be used by the converters and bilingual file type components

    Declaration
    IDocumentItemFactory ItemFactory { get; set; }
    Property Value
    Type Description
    IDocumentItemFactory

    NativeGeneratorProvider

    When converting to native format, this property represents the provider that will attempt to create IFileGenerator instances, and provide output settings when needed by the framework.

    This property should be null if not converting to native format.

    Declaration
    NativeGeneratorProvider NativeGeneratorProvider { get; set; }
    Property Value
    Type Description
    NativeGeneratorProvider
    Remarks

    The BuildNativeGenerator(IPersistentFileConversionProperties) method can be used as an implementation for this delegate.

    OutputPropertiesProvider

    When converting to native format, this property must be set. This delegate is called by the converter to set the output filename, encoding, language, etc. for each native file produced.

    Declaration
    OutputPropertiesProvider OutputPropertiesProvider { get; set; }
    Property Value
    Type Description
    OutputPropertiesProvider

    PropertiesFactory

    Convenience getter for the properties factory that will be used by the converters and file type components. The implementation should return the properties factory from the document item factory, or null if none.

    Declaration
    IPropertiesFactory PropertiesFactory { get; }
    Property Value
    Type Description
    IPropertiesFactory

    SharedObjects

    The shared objects that will be communicated across all components that are used in content processing. Components that implement ISharedObjectsAware will receive this interface via the SetSharedObjects(ISharedObjects) method before they are used for content processing.

    Declaration
    ISharedObjects SharedObjects { get; }
    Property Value
    Type Description
    ISharedObjects
    Remarks

    Applications may publish objects to be used by file type components during the conversion process by calling PublishSharedObject(String, Object, IdConflictResolution).

    Methods

    AddExtractor(IFileExtractor)

    Adds another file converter to be used. The converter should be initialized properly.

    Declaration
    void AddExtractor(IFileExtractor extractor)
    Parameters
    Type Name Description
    IFileExtractor extractor

    ApplyDocumentPropertiesToExtractors()

    Updates the file properties for each of the extractors to use the source and target languages specified in the document properties.

    Declaration
    void ApplyDocumentPropertiesToExtractors()

    InsertExtractor(Int32, IFileExtractor)

    Inserts a file converter to be used at a specific index. The converter should be initialized properly.

    Declaration
    void InsertExtractor(int index, IFileExtractor extractor)
    Parameters
    Type Name Description
    System.Int32 index
    IFileExtractor extractor

    Parse()

    Initializes the file type components and repeatedly invokes the ParseNext method on the parser until all content has been processed.

    If there is a native parser, it will be used. Otherwise ,if there is a bilingual parser, that parser will be used. If no parser has been specified, an exception will be thrown.

    Declaration
    void Parse()
    Remarks

    Always call this or the ParseNext method on the converter, never directly on the parser, since this will not initialize the file type components properly.

    ParseNext()

    Invokes the ParseNext() method on the appropriate parser, causing a chunk of content to be processed. Ensures that the the parser components are initialized before parsing commences for the first time.

    Declaration
    bool ParseNext()
    Returns
    Type Description
    System.Boolean

    True if there is more content to be parsed

    RemoveExtractor(IFileExtractor)

    Removes the specified converter.

    Declaration
    bool RemoveExtractor(IFileExtractor extractor)
    Parameters
    Type Name Description
    IFileExtractor extractor

    Converter to be removed

    Returns
    Type Description
    System.Boolean

    True if the converter was part of the collection, false if no change was made

    SetDocumentInfo(IDocumentProperties, Boolean)

    Set document properties, optionally updating source and target languages for each of the extractors.

    Declaration
    void SetDocumentInfo(IDocumentProperties newDocumentInfo, bool applyToAllExtractors)
    Parameters
    Type Name Description
    IDocumentProperties newDocumentInfo
    System.Boolean applyToAllExtractors

    SynchronizeDocumentProperties()

    Properly synchronizes document properties between the converter and its extractors. If document properties are available from a bilingual parser, they will be used. Otherwise, the document properties will be deducted by querying existing extractors for languages.

    Declaration
    void SynchronizeDocumentProperties()
    Remarks

    If the first extractor has a bilingual parser, use its document properties if available (by calling SetDocumentInfo(IDocumentProperties, Boolean)). Otherwise, call UpdateDocumentPropertiesFromExtractors() to retrieve the properties from the extractors, and if they are valid (DetectedLanguagesCorrespondToDocumentProperties returns true), communicate them to all the extractors (by calling ApplyDocumentPropertiesToExtractors()).

    UpdateDocumentPropertiesFromExtractors()

    Set source and target languages of the document properties from the properties detected by the file sniffers associated with the extractors. If different extractors have detected differing languages with certainty, this method does not change the document properties and returns false. If different languages are detected with a detection level less then certain, the language with the highest detection level will be used. If there is more than one language, the first one will take precedence.

    If a target language has been set in the document properties, but no target language has been detected in the extractors, the target language of the document properties will be set to an uninitialized value.

    Declaration
    bool UpdateDocumentPropertiesFromExtractors()
    Returns
    Type Description
    System.Boolean

    True if there were no conflicting languages and the document properties have been updated.

    Events

    Message

    Raised when a message is reported from a file type component.

    Declaration
    event EventHandler<MessageEventArgs> Message
    Event Type
    Type Description
    System.EventHandler<MessageEventArgs>

    Progress

    This event is fired when any of the the native or bilingual parser fires progress events.

    The reported progress constitutes the computed total progress for all files being processed.

    Declaration
    event EventHandler<BatchProgressEventArgs> Progress
    Event Type
    Type Description
    System.EventHandler<BatchProgressEventArgs>

    On this page

    • Properties
      • BilingualDocumentGenerator
      • BilingualDocumentOutputProperties
      • BilingualDocumentOutputPropertiesProvider
      • BilingualVerifiersProvider
      • DependencyFileLocator
      • DetectedLanguagesCorrespondToDocumentProperties
      • DetectedSourceLanguage
      • DetectedTargetLanguage
      • DocumentInfo
      • Extractors
      • ItemFactory
      • NativeGeneratorProvider
      • OutputPropertiesProvider
      • PropertiesFactory
      • SharedObjects
    • Methods
      • AddExtractor(IFileExtractor)
      • ApplyDocumentPropertiesToExtractors()
      • InsertExtractor(Int32, IFileExtractor)
      • Parse()
      • ParseNext()
      • RemoveExtractor(IFileExtractor)
      • SetDocumentInfo(IDocumentProperties, Boolean)
      • SynchronizeDocumentProperties()
      • UpdateDocumentPropertiesFromExtractors()
    • Events
      • Message
      • Progress
    Back to top Generated by DocFX