Wiki

Clone wiki

Okapi / BasicObjectsAndInterfaces

Basic Objects and Interfaces

ISegment

Many functions of translation and localization tools revolve around the segment. So it is logical to start with an ISegment interface. This interface provides a common way for all other components to access a pre-parsed segment.

The class has methods to construct the object step by step (by chunks of text, by characters, by codes, etc.), and to manipulate the content with string-like methods, and to output the content to different format.

IFilter

Translatable text comes from various material, most of them files in different formats, but also database, and other types of input. To handle this a generic IFilter interface allows all the components to handle the various input the same way. This interface provides a way to extract the text into logical units for the input (for example: paragraphs, strings, widget’s labels, etc.).

See also IFilter

IUnit

The units generated by a IFilter implementation are exposed through the IUnit interface. The IUnit interface extends the ISegment interface.

Each unit comes with a few properties extracted along with the text. Not all input provides all properties, but there is a set common enough to make the case for them to be carried along with the text. Such properties would be for example: extraction ID, resource type, resource name, start and length in the original extracted file (useful for context display by some tools), possible notes attached to the unit, etc.

ISegmenter

Often, to be useful, the units need to be broken-down into segments (e.g. a paragraph split into sentences). This can be done through an object that implements the ISegmenter interface. It takes an ISegment object as input (so in most cases an IUnit), and outputs one or more ISegment objects.

The reference implementation of ISegment uses the SRX standard. The framework will also provide a set of default SRX rules for different languages.

ILog

Some of the classes in the framework need to have a mechanism to report errors and warnings (for example, a filter may need to report some warning about some specific things it finds in an input file, without stopping the extraction process). The ILog interface provides a common way to follow the progress of a task, possibly interrupt it, and log errors and warnings.

IParameters

The IParameters interface allows components to exchange parameters independently of the object type (used by other interface for example). This is used to pass a set of parameters from a server-side object to a UI dialog for example. The data can be passed as object or serialized in strings. On representation possible would be JSON strings.

IParametersEditor

This interface provides a way to call in a generic way an editor to modify the parameters of a component. The parameters are implemented through the IParameters interface.

IParametersProvider

The components that generate the parameters can be different from the one where they are edited (for example client/server applications). The IParametersProvider interface provides a way to load and save parameters across components.

Updated