file2xliff4j
Interface Converter

All Known Implementing Classes:
ExcelExporter, ExcelImporter, HtmlExporter, HtmlImporter, JavaPropertiesExporter, JavaPropertiesImporter, MifExporter, MifImporter, OdfExporter, OdfImporter, OOoTextExporter, OOoTextImporter, PdfExporterToHtml, PdfExporterToOOoText, PdfExporterToPlaintext, PdfExporterToWord, PdfImporter, PlaintextExporter, PlaintextImporter, PoExporter, PoImporter, PPTExporter, PPTImporter, RTFExporter, RTFImporter, WinRcExporter, WinRcImporter, WordExporter, WordImporter, XliffImporter, XMLExporter, XMLImporter, XulDtdExporter, XulDtdImporter

public interface Converter

Author:
Weldon Whipple <weldon@lingotek.com>

Field Summary
static int BLKSIZE
          Block size constant for heirs to use in reading and writing files
static java.lang.String formatSuffix
          The format file associated with a native file has the same name as the native file, with the following suffixed:
static java.lang.String skeletonSuffix
          The skeleton file associated with a native file has the same name as the native file, with the following suffixed:
static java.lang.String startXliff
          Introduces the xliff element of an XLIFF document:
static java.lang.String stylesTSkeletonSuffix
          Some converters need to create an intermediate "temporary" skeleton file for styles, which is later processed to help create the final skeleton file.
static java.lang.String tSkeletonSuffix
          Some converters need to create an intermediate "temporary" skeleton file, which is later processed to create the final skeleton file.
static java.lang.String xliffSuffix
          The xliff file associated with a native file has the same name as the native file, with the following suffixed:
static java.lang.String xmlDeclaration
          Used at the top of generated XML files:
 
Method Summary
 ConversionStatus convert(ConversionMode mode, java.util.Locale language, java.lang.String phaseName, int maxPhase, java.nio.charset.Charset nativeEncoding, FileType nativeFileType, java.lang.String nativeFileName, java.lang.String baseDir, Notifier notifier)
          Deprecated. 
 ConversionStatus convert(ConversionMode mode, java.util.Locale language, java.lang.String phaseName, int maxPhase, java.nio.charset.Charset nativeEncoding, FileType nativeFileType, java.lang.String nativeFileName, java.lang.String baseDir, Notifier notifier, SegmentBoundary boundary, java.io.StringWriter generatedFileName)
          Convert a file from a Native format to XLIFF, or from XLIFF (back) to the original native format.
 ConversionStatus convert(ConversionMode mode, java.util.Locale language, java.lang.String phaseName, int maxPhase, java.nio.charset.Charset nativeEncoding, FileType nativeFileType, java.lang.String nativeFileName, java.lang.String baseDir, Notifier notifier, SegmentBoundary boundary, java.io.StringWriter generatedFileName, java.util.Set<f2xutils.XMLTuXPath> skipList)
          Convert a file from a Native format to XLIFF, or from XLIFF (back) to the original native format.
 java.lang.Object getConversionProperty(java.lang.String property)
          Return an object representing a format-specific (and converter-specific) property.
 FileType getFileType()
          Return the file type that this converter handles.
 void setConversionProperty(java.lang.String property, java.lang.Object value)
          Set a format-specific property that might affect the way that the conversion occurs.
 

Field Detail

xmlDeclaration

static final java.lang.String xmlDeclaration
Used at the top of generated XML files:

See Also:
Constant Field Values

startXliff

static final java.lang.String startXliff
Introduces the xliff element of an XLIFF document:

See Also:
Constant Field Values

xliffSuffix

static final java.lang.String xliffSuffix
The xliff file associated with a native file has the same name as the native file, with the following suffixed:

See Also:
Constant Field Values

tSkeletonSuffix

static final java.lang.String tSkeletonSuffix
Some converters need to create an intermediate "temporary" skeleton file, which is later processed to create the final skeleton file. This declares its suffix:

See Also:
Constant Field Values

stylesTSkeletonSuffix

static final java.lang.String stylesTSkeletonSuffix
Some converters need to create an intermediate "temporary" skeleton file for styles, which is later processed to help create the final skeleton file. This declares its suffix:

See Also:
Constant Field Values

skeletonSuffix

static final java.lang.String skeletonSuffix
The skeleton file associated with a native file has the same name as the native file, with the following suffixed:

See Also:
Constant Field Values

formatSuffix

static final java.lang.String formatSuffix
The format file associated with a native file has the same name as the native file, with the following suffixed:

See Also:
Constant Field Values

BLKSIZE

static final int BLKSIZE
Block size constant for heirs to use in reading and writing files

See Also:
Constant Field Values
Method Detail

convert

ConversionStatus convert(ConversionMode mode,
                         java.util.Locale language,
                         java.lang.String phaseName,
                         int maxPhase,
                         java.nio.charset.Charset nativeEncoding,
                         FileType nativeFileType,
                         java.lang.String nativeFileName,
                         java.lang.String baseDir,
                         Notifier notifier,
                         SegmentBoundary boundary,
                         java.io.StringWriter generatedFileName,
                         java.util.Set<f2xutils.XMLTuXPath> skipList)
                         throws ConversionException
Convert a file from a Native format to XLIFF, or from XLIFF (back) to the original native format.

Parameters:
mode - The mode of conversion (to or from XLIFF).
language - The language of the native document. If we are converting from a native format to XLIFF, the language becomes the <source> xml:lang in the XLIFF. If conversion is from XLIFF back to the native format, the language selects which <target> (in the XLIFF's translation-units) will provide the strings for the destination native document.
phaseName - The name of the phase to convert. (This is meaningful only for conversions from XLIFF back to the native format, where there are multiple target elements for the same locale, differentiated only by the optional phase-name attribute.) This parameter is ignored if conversion is to XLIFF. If converting from XLIFF back to a native format and the XLIFF target elements do not use the phase-name attribute, specify null for this parameter.

Special behavior: If the phase name string consists entirely of numeric digits equivalent to an integer with value greater than 1 but less than or equal to maxPhase (see below), the implementation may choose to search for targets with phase-names of earlier numerically named phase names.

maxPhase - The maximum phase number. (This is meaningful only for conversions from XLIFF back to the native format, where there are multiple target elements for the same locale, differentiated only by the optional phase-name attribute.) This parameter is ignored if conversion is to XLIFF.

If phaseName is specified as "0" and maxPhase is a non-negative integer, search for the highest "numbered" phase, starting at maxPhase, and searching down to phase "1".

nativeEncoding - The encoding of the native document. If we are converting a native document to XLIFF, this parameter tells the converter how to interpret the bytes read from the native document as it converts to UTF-8 used by XLIFF. If conversion is from XLIFF back to the native format, this parameter tells the converter what to convert the UTF-8- encoding back to.

Note: If the native format offers no choice of encoding, then this parameter's value is ignored.

nativeFileType - The type of the native file. Examples: "HTML", "WORD". (Note: This parameter is needed only when converting to XLIFF, to provide a value for the datatype attribute of the XLIFF's file element.) If converting from XLIFF, the datatype is read from the XLIFF file; this parameter is ignored.
nativeFileName - The name of the native file. If we are converting from a native format to XLIFF, this specifies the name of the file to convert to XLIFF. If conversion is from XLIFF back to the native format, this parameter specifies the name of the file generated from XLIFF.
baseDir - The directory (in the file system) from which input files will be read, and to which output files will be written.
notifier - Instance of a class that implements the Notifier interface (to send notifications in case of conversion error).
boundary - The boundary on which to segment translation units (e.g., on paragraph or sentence boundaries)
generatedFileName - If this parameter is non-null, the converter implementation might write the name of the generated output file to this parameter (a StringWriter).
skipList - A set of potential translatable structures to omit. (This is applicable to the import--conversion to XLIFF--of XML files, for example.).
Returns:
Indicator of the status of the conversion.
Throws:
ConversionException - If a conversion exception is encountered.

convert

ConversionStatus convert(ConversionMode mode,
                         java.util.Locale language,
                         java.lang.String phaseName,
                         int maxPhase,
                         java.nio.charset.Charset nativeEncoding,
                         FileType nativeFileType,
                         java.lang.String nativeFileName,
                         java.lang.String baseDir,
                         Notifier notifier,
                         SegmentBoundary boundary,
                         java.io.StringWriter generatedFileName)
                         throws ConversionException
Convert a file from a Native format to XLIFF, or from XLIFF (back) to the original native format.

Parameters:
mode - The mode of conversion (to or from XLIFF).
language - The language of the native document. If we are converting from a native format to XLIFF, the language becomes the <source> xml:lang in the XLIFF. If conversion is from XLIFF back to the native format, the language selects which <target> (in the XLIFF's translation-units) will provide the strings for the destination native document.
phaseName - The name of the phase to convert. (This is meaningful only for conversions from XLIFF back to the native format, where there are multiple target elements for the same locale, differentiated only by the optional phase-name attribute.) This parameter is ignored if conversion is to XLIFF. If converting from XLIFF back to a native format and the XLIFF target elements do not use the phase-name attribute, specify null for this parameter.

Special behavior: If the phase name string consists entirely of numeric digits equivalent to an integer with value greater than 1 but less than or equal to maxPhase (see below), the implementation may choose to search for targets with phase-names of earlier numerically named phase names.

maxPhase - The maximum phase number. (This is meaningful only for conversions from XLIFF back to the native format, where there are multiple target elements for the same locale, differentiated only by the optional phase-name attribute.) This parameter is ignored if conversion is to XLIFF.

If phaseName is specified as "0" and maxPhase is a non-negative integer, search for the highest "numbered" phase, starting at maxPhase, and searching down to phase "1".

nativeEncoding - The encoding of the native document. If we are converting a native document to XLIFF, this parameter tells the converter how to interpret the bytes read from the native document as it converts to UTF-8 used by XLIFF. If conversion is from XLIFF back to the native format, this parameter tells the converter what to convert the UTF-8- encoding back to.

Note: If the native format offers no choice of encoding, then this parameter's value is ignored.

nativeFileType - The type of the native file. Examples: "HTML", "WORD". (Note: This parameter is needed only when converting to XLIFF, to provide a value for the datatype attribute of the XLIFF's file element.) If converting from XLIFF, the datatype is read from the XLIFF file; this parameter is ignored.
nativeFileName - The name of the native file. If we are converting from a native format to XLIFF, this specifies the name of the file to convert to XLIFF. If conversion is from XLIFF back to the native format, this parameter specifies the name of the file generated from XLIFF.
baseDir - The directory (in the file system) from which input files will be read, and to which output files will be written.
notifier - Instance of a class that implements the Notifier interface (to send notifications in case of conversion error).
boundary - The boundary on which to segment translation units (e.g., on paragraph or sentence boundaries)
generatedFileName - If this parameter is non-null, the converter implementation might write the name of the generated output file to this parameter (a StringWriter).
Returns:
Indicator of the status of the conversion.
Throws:
ConversionException - If a conversion exception is encountered.

convert

@Deprecated
ConversionStatus convert(ConversionMode mode,
                                    java.util.Locale language,
                                    java.lang.String phaseName,
                                    int maxPhase,
                                    java.nio.charset.Charset nativeEncoding,
                                    FileType nativeFileType,
                                    java.lang.String nativeFileName,
                                    java.lang.String baseDir,
                                    Notifier notifier)
                         throws ConversionException
Deprecated. 

Convert a file from a Native format to XLIFF, or from XLIFF (back) to the original native format.

Parameters:
mode - The mode of conversion (to or from XLIFF).
language - The language of the native document. If we are converting from a native format to XLIFF, the language becomes the <source> xml:lang in the XLIFF. If conversion is from XLIFF back to the native format, the language selects which <target> (in the XLIFF's translation-units) will provide the strings for the destination native document.
phaseName - The name of the phase to convert. (This is meaningful only for conversions from XLIFF back to the native format, where there are multiple target elements for the same locale, differentiated only by the optional phase-name attribute.) This parameter is ignored if conversion is to XLIFF. If converting from XLIFF back to a native format and the XLIFF target elements do not use the phase-name attribute, specify null for this parameter.

Special behavior: If the phase name string consists entirely of numeric digits equivalent to an integer with value greater than 1 but less than or equal to maxPhase (see below), the implementation may choose to search for targets with phase-names of earlier numerically named phase names.

maxPhase - The maximum phase number. (This is meaningful only for conversions from XLIFF back to the native format, where there are multiple target elements for the same locale, differentiated only by the optional phase-name attribute.) This parameter is ignored if conversion is to XLIFF.

If phaseName is specified as "0" and maxPhase is a non-negative integer, search for the highest "numbered" phase, starting at maxPhase, and searching down to phase "1".

nativeEncoding - The encoding of the native document. If we are converting a native document to XLIFF, this parameter tells the converter how to interpret the bytes read from the native document as it converts to UTF-8 used by XLIFF. If conversion is from XLIFF back to the native format, this parameter tells the converter what to convert the UTF-8- encoding back to.

Note: If the native format offers no choice of encoding, then this parameter's value is ignored.

nativeFileType - The type of the native file. Examples: "HTML", "WORD". (Note: This parameter is needed only when converting to XLIFF, to provide a value for the datatype attribute of the XLIFF's file element.) If converting from XLIFF, the datatype is read from the XLIFF file; this parameter is ignored.
nativeFileName - The name of the native file. If we are converting from a native format to XLIFF, this specifies the name of the file to convert to XLIFF. If conversion is from XLIFF back to the native format, this parameter specifies the name of the file generated from XLIFF.
baseDir - The directory (in the file system) from which input files will be read, and to which output files will be written.
notifier - Instance of a class that implements the Notifier interface (to send notifications in case of conversion error).
Returns:
Indicator of the status of the conversion.
Throws:
ConversionException - If a conversion exception is encountered.

getConversionProperty

java.lang.Object getConversionProperty(java.lang.String property)
Return an object representing a format-specific (and converter-specific) property.

Parameters:
property - The name of the property to return.
Returns:
An Object that represents the property's value.

getFileType

FileType getFileType()
Return the file type that this converter handles. (For importers, this means the file type that it imports to XLIFF; for exporters, it is the file type that ie exports to (from XLIFF).

Returns:
The file type that the converter handles.

setConversionProperty

void setConversionProperty(java.lang.String property,
                           java.lang.Object value)
                           throws ConversionException
Set a format-specific property that might affect the way that the conversion occurs.

Parameters:
property - The name of the property
value - The value of the property
Throws:
ConversionException - If the property isn't recognized (and if it matters).