Click or drag to resize
IFileTypeManagerGetConverterToNative Method (String, OutputPropertiesProvider, EventHandlerMessageEventArgs)
Creates a converter for parsing a single file and writing native output files.

This is intended for bilingual file types, in which the languages and codepage can be deducted automatically from the file content.

This version is typically used for parsing SDL XLIFF documents (where support for these have been installed as another bilingual file type). However, it could also be used for processing individual native files in which source language (and codepage) can be deducted from the file content.

Namespace: Sdl.FileTypeSupport.Framework.IntegrationApi
Assembly: Sdl.FileTypeSupport.Framework.Core (in Sdl.FileTypeSupport.Framework.Core.dll) Version: 1.0.0.0 (1.0.2343.0)
Syntax
IMultiFileConverter GetConverterToNative(
	string bilingualInputFilePath,
	OutputPropertiesProvider outputSettingsProvider,
	EventHandler<MessageEventArgs> messageHandler
)

Parameters

bilingualInputFilePath
Type: SystemString
Full path to a bilingual (typically SDL XLIFF) file
outputSettingsProvider
Type: Sdl.FileTypeSupport.Framework.IntegrationApiOutputPropertiesProvider
(Optional) implementation of the output settings provider that will be passed to the multi-file converter and used for writing files as native.

If this parameter is provided (i.e. not null), the returned converter will be initialized to use this file type manager to create native file generators, and the specified output settings provider will be used to determine output properties for the native files when they are created.

messageHandler
Type: SystemEventHandlerMessageEventArgs
An (optional) message handler implementation that will receive any messages reported from file sniffers invoked in the process. If a converter is returned, this message handler will also be connected to the Message event on the converter. You may specify null for this parameter.

Return Value

Type: IMultiFileConverter
A file converter that may be used to convert bilingual files to native output files
Remarks
If language (and/or codepage) cannot be successfully determined by the file type components, an exception should be thrown.
Remarks
Examples
The following code example shows how to convert an SDL XLIFF file into native target language files.
void SaveAsTarget(IFileTypeManager manager, string xliffFilePath, string outputFolder)
{
   FolderPathProvider pathProvider = new FolderPathProvider(outputFolder);
   IMultiFileConverter converter = manager.GetConverterToNative(xliffFilePath, pathProvider.Provider, settingsBundle);
   converter.AddBilingualProcessor(new SourceToTargetCopier(ExistingContentHandling.Preserve));
   converter.Parse();
}
Note that a SourceToTargetCopier object is used to ensure that ParagraphUnits without target content are output as source (they would otherwise be emitted as nothing, which could lead to unexpected results).
See Also
Community
Edit
Be the first to Edit the community content of this topic.
Comments