Custom translation connector
In addition to the built-in Translation module connectors, you can implement your own translation connector with custom logic to serve your requirements. You do this by using the Translation API to implement the overall translation process and then configuring Sitefinity CMS to use your connector in one of the ways described in this article.
Automatic configuration
In Sitefinity CMS you can automatically configure a connector to a translation service using an assembly attribute. The assembly attribute is called TranslationConnectorAttribute
.
When the website initializes, Sitefinity CMS looks in the /bin
folder for assemblies that contain connector implementations and are marked with this attribute. In case it finds such assemblies, Sitefinity CMS automatically adds the translation connector’s configurations that are specified in the assembly attribute.
The TranslationConnectorAttribute
has the following parameters:
Name
- the name of the translation connector.
For example, ClayTablet
ConnectorType
- the ASP.NET type of the translation connector.
For example, Telerik.Sitefinity.Translations.ClayTablet.ClayTabletTranslationConnector
Title
- the title of the connector that appears in the UI.
For example, Export to Clay Tablet
Enabled
- a Boolean value that indicates whether the connector is enabled.
For example, true
RemoveHtmlTags
- a Boolean value that indicates whether the connector parses HTML content in chunks and removes the HTML tags.
For example, if true, Sitefinity CMS removes all HTML tags and sends for translation text only.
SupportedLanguages
- gets the language pairs that the connector supports.
For example, German to English or Spanish to Japanese.
parameters
– a collection of user-defined parameter keys and their values that are used by the connector.
GITHUB EXAMPLE: You can see an example of the TranslationConnectorAttribute
assembly attribute in Sitefinity’s GitHub repository » microsoft-machine-translator-connector » MicrosoftMachineTranslatorConnector.cs
Manual configuration
In addition to the abovementioned assembly attribute, you can make the same translation connector configurations using the Advanced settings UI.
To configure a connector, perform the following:
- In Sitefinity CMS backend, navigate to Administration » Settings » Advanced.
- In the tree on the left, expand Translations.
- Click Connectors » Create new.
- Configure the available settings as described in the Automatic configuration section above.
- Save your changes.
- To configure additional user-defined parameters, expand the newly created connector and click Parameters » Create new.
- Create the required parameters and save your changes.
Sample implementations of custom translation connectors
- Translations.com
To download an implementation of a custom translation connector that works with Translations.com service, see Sitefinity CMS GitHub repository » Telerik.Sitefinity.Translations.TranslationsCom.
- Microsoft Azure Translator Text
To download an implementation of a custom translation connector that works with Microsoft's Translator Text service, see Sitefinity CMS GitHub repository » microsoft-machine-translator-connector.
- Systran Machine Translation Connector
To download an implementation of a custom translation connector that works with Microsoft's Translator Text service, see Sitefinity CMS GitHub repository » SystranMTConnector