| 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.IntegrationApiAssembly: Sdl.FileTypeSupport.Framework.Core (in Sdl.FileTypeSupport.Framework.Core.dll) Version: 1.0.0.0 (1.0.2343.0)
SyntaxIMultiFileConverter GetConverterToNative(
string bilingualInputFilePath,
OutputPropertiesProvider outputSettingsProvider,
EventHandler<MessageEventArgs> messageHandler
)
Function GetConverterToNative (
bilingualInputFilePath As String,
outputSettingsProvider As OutputPropertiesProvider,
messageHandler As EventHandler(Of MessageEventArgs)
) As IMultiFileConverter
IMultiFileConverter^ GetConverterToNative(
String^ bilingualInputFilePath,
OutputPropertiesProvider^ outputSettingsProvider,
EventHandler<MessageEventArgs^>^ messageHandler
)
abstract GetConverterToNative :
bilingualInputFilePath : string *
outputSettingsProvider : OutputPropertiesProvider *
messageHandler : EventHandler<MessageEventArgs> -> IMultiFileConverter
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:
IMultiFileConverterA 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
Comments