Content translation/Machine Translation/MT Clients

Machine translation services are accessed using client modules in Content translation. We have apertium and yandex clients written already in the code. It is possible to add any number of such MT service clients and map to language pairs. This documentation explains the Machine translation client architecture.

Writing a new MT Client Module
The best way to learn this is to refer an existing client module like Yandex or Apertium. The client modules are present in cxserver's mt folder. Let us call our client as BabelFish MT Client. Create a file named BabelFish.js in mt folder

If your BabelFish service is not capable of translating HTML by retaining all markup in appropriate position in translation, instead of translate, you will have to write translateText method in the above code. Refer Apertium.js for such an example. Yandex.js is an example for MT client that is capable of handling both html and text content.

You need to add an entry in mt/index.js for your new client.

To map a language pair to use this client, refer config.default.js in the source code of cxserver. If you want only to experiment and not to add this client for that language pair, add the registry entry to config.js(create that file if does not exist).

Restart the cxserver and test your client. You may want to read some unit tests existing for Apertium to write your own tests.