Click or drag to resize
IFileTypeManagerGetConverterToDefaultBilingual Method (String, String, CultureInfo, Codepage, EventHandlerMessageEventArgs)
Creates and initializes a file converter in order to create a bilingual file in the default format.

The converter will automatically use the filters that best match the native files to be converted. These converters are selected as described below.

The file type definitions are each tested in sequence, and the first file type definition that matches a file is used for each file. The following steps are used to determine if a file type definition matches a file:

  1. The regular expression is evaluated against the name of the file to be converted. If it does not match, the file type definition is not used.
  2. If a file sniffer is defined for the file type definition, it is applied to the file. If the file sniffer does not indicate that the file is supported, the file type definition is not used.
If no matching file type definition is found, a OneOrMoreFilesNotSupportedException is thrown.

Namespace: Sdl.FileTypeSupport.Framework.IntegrationApi
Assembly: Sdl.FileTypeSupport.Framework.Core (in Sdl.FileTypeSupport.Framework.Core.dll) Version: 1.0.0.0 (1.0.2551.0)
Syntax
IMultiFileConverter GetConverterToDefaultBilingual(
	string[] nativeFilePaths,
	string bilingualOutputFilePath,
	CultureInfo sourceLanguage,
	Codepage suggestedCodepage,
	EventHandler<MessageEventArgs> messageHandler
)

Parameters

nativeFilePaths
Type: SystemString
The native files to be converted.
bilingualOutputFilePath
Type: SystemString
Full path to the bilingual file to be created.
sourceLanguage
Type: System.GlobalizationCultureInfo
Expected source language of the files.

The same source (and target) language must be used for all the files processed with a single converter instance.

If the language can be determined automatically from the content of the file (e.g. when reading a bilingual format such as TTX), this parameter may be ignored by the parser. If this parameter is left undefined, it is up to the file sniffer and/or parser to try to determine the language. Parser components may report an error or a warning if they cannot reliably identify the language.

suggestedCodepage
Type: Sdl.Core.GlobalizationCodepage
A rough guess of what encoding the files use. This is normally set to the default codepage for the language, but can also be null. This serves only as a hint. A file sniffer can be used to determine the actual encoding for each file. An undefined codepage object can be used if no encoding can be guessed. It is then up to the file sniffer and/or parser to best determine the encoding and report an error if they fail, or a warning if the result is not definite.
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 have been connected to the Message event on the converter. You may specify null for this parameter.

Return Value

Type: IMultiFileConverter
A file converter object initialized to read the files, based on information from the best matching file type definitions. To use the file converter, add your own bilingual processors to the converter and call Parse or ParseNext to process the native files.
Exceptions
ExceptionCondition
OneOrMoreFilesNotSupportedException thrown if there are files for which no file type definition in the file type manager can be used.
Remarks
Examples
This example shows how this method could be used convert a bunch of native files into a single SDL XLIFF document.
void ConvertFilesToXliff(IFileTypeManager manager, string[] nativeFiles, CultureInfo language, Codepage suggestedCodepage, string xliffFilePath)
{
    IMultiFileConverter converter = manager.GetConverterToDefaultBilingual(nativeFiles[], xliffFilePath, language, suggestedCodepage, null, settingsBundle);
    converter.Parse();
}
See Also
Community
Edit

Be the first to Edit the community content of this topic.
Comments