Creating the Translation Provider
This section explains how to create a class that implements the ITranslationProvider interface. This class forms the core of a custom translation provider plug-in.
Overview
A translation provider represents a translation engine that translates segments. It implements ITranslationProvider and exposes the following areas of behavior:
- Translation method: The TranslationMethod property identifies the translation engine that generates results. Some search options in Trados Studio determine whether Trados Studio calls a provider. If a TM result already exists, Trados Studio may not query the MT provider for additional suggestions.
- Supported features: The provider reports which functionality it supports through a set of
Supports...properties. Trados Studio uses these values to decide when and how to use the provider. See Supported Features. - Language directions: The provider indicates which language directions it supports and returns a language direction (ITranslationProviderLanguageDirection) through the GetLanguageDirection method. See Language Directions.
- Serializing and loading state: When Trados Studio adds a provider to a project, it serializes two values: the URI (Uri) and additional state information. See Serializing and Loading State.
A translation provider can support one or more language directions, or source-target language combinations. A class that implements ITranslationProviderLanguageDirection provides the functionality for a specific language direction.
Supported Features
For more information about the properties that indicate whether a translation provider supports specific functionality or content, see ITranslationProvider.
Language Directions
A translation provider language direction uses a source language and a target language. Both should be region-qualified cultures. The interface defines two methods related to language directions:
- SupportsLanguageDirection: Checks whether the translation provider supports the specified region-qualified source-target language pair.
- GetLanguageDirection: Returns a ITranslationProviderLanguageDirection for a supported language pair. The ITranslationProviderLanguageDirection exposes language-direction-specific methods for translation unit lookups and updates. Depending on the features that the provider supports, you can use some or all of these methods.
Serializing and Loading State
When Trados Studio adds a translation provider to a project, it serializes two pieces of information: the URI and the additional state. The additional state can include settings that the translation provider requires.
Serialize state by using the SerializeState method. The translation provider implementation can choose the format it uses to serialize state. Trados Studio stores this state information in the project. Because packages include the state information, avoid storing sensitive data such as credentials there. Use the separate mechanism for credentials and other user-specific settings. For more information, see the Authentication section in Creating the Translation Provider Factory.