How to make sure your custom ContentProvider supports machine translation via Translation.com
Translations.com has provided a Translation Connector to the Episerver community that ties Episerver Commmerce and Episerver CMS – being Pages, Blocks and Catalog items – with their existing GlobalLink Translation suite. Large Episerver solutions tend to require custom Content Types, which also requires translation during the authoring flows, via customized ContentProviders. My experience tells me that business users expects that these custom Content Types provides a similar workflow for translation. Question is, how can that be achieved and what does it take?
Enable translation, via Translation.com, for your custom Content Provider
Honestly, it does not require a lot. There are only a few details that you need to be aware of. First of three, your custom Content Type has to implement ILocalizable and ILocale. These interfaces requires you to deal with the language part of your content and ensures that diversity in content, across Episerver Language Branches, is supported.
Next step is to ensure that your ContentProvider indicates that it supports multi-lingual content. It can be done either via the initialization of your ContentProvider or by overriding the ProviderCapabilities property of ContentProvider. My example adds multi-lingual support via initialization because that is the approach most tutorials tend to use.
Translations.com are, for some reason, relying on “Available in Editmode” to determine if a particular Content Type can be carried through the translation flow. Ensure that your Content Type is available in edit mode is simple:
Last but not least, a quick hint: do not to rely on ContentLanguage.PreferredLanguage in your ContentProvider during Save and Load. It will, due to the nature of Scheduled Jobs, be your master language and it will potentially lead to unintended overwritten content.
Please be aware that these steps of course assumes that your ContentProvider already is implemented and that your data afterwards is persisted and fetched in the context of a language. My examples are based on a similar approach to what Per Magne Skuseth details in his guides here.
After applying these simple steps, the Translations.com GlobalLink connector will automatically call your Save method with a localized version of the content included in your submission. More information about the Translations.com GlobalLink add-on is available here.