Language Service Providers
The Worldwide Lexicon Platform provides a simple asynchronous API for dispatching calls to third party translation service providers or LSPs. This interface makes it easy to integrate external translation systems, volunteer communities, etc with your translation memory.
To support this service, all you need to do is to implement a web API on your system to accept translation requests from the WWL server, and then to make a callback request to WWL when it is completed.
Sending Translation Requests From WWL
The Worldwide Lexicon server will call out to your system by posting a form to a URL on your system. It will send the following parameters:
- action : action requested (translate, score; if omitted assume it is a translation request)
- guid : record locator for request
- sl : source language code
- tl : target language code
- st : source text
- domain : web domain (e.g. www.xyz.com)
- url : source document url
- output : output format (xml, rss, json; recommend json)
- pw : password or API key
- callback : URL for callback request (if omitted, use www.worldwidelexicon.org/submit
WWL will expect an 'ok' or error message, followed by an optional translated text from your translation memory (only if there is an exact match).
Returning Results From Your Translation Memory
If there is an exact match for the requested source text and target language in your translation memory, you can return this in response to the translation request. You should format your response as follows:
ok
This is a translation.
Where the response message 'ok' is followed by a line break, and then by the translation (UTF 8 encoding). If there are multiple translations, you should decide which one to return. This translation will be copied into the WWL translation memory immediately.
Submitting Translations To WWL
When the translation is completed, simply send the text to the callback URL with the original request, or if omitted, use www.worldwidelexicon.org/queue/submit as the URL. You should include the following parameters with the submission (use UTF-8 encoding):
- guid : record locator
- sl : source language code
- tl : target language code
- st : source text
- tt : translated text
- domain : domain
- url : source url
- username : username to attribute translation to (e.g. bob@yourservice)
- remote_addr : user IP address (optional)
This API responds with 'ok' or error message.
Joining the Public WWL Network
When you are ready to begin testing your implementation, email bsmcconnell /at/ gmail with the incoming URL for your API, as well as the IP address you will be submitting translations from. We will add you to the default list of language service providers, at which point you will be able to send requests via the /t web API on WWL.
Configuring Your WWL System To Allow Third-Party Services
The config.py file is used to configure support for third-party language services. There is a section for Language Service Providers where you can set the following options for each LSP:
- URL to send translation requests to
- IP address to expect translations from
- Allowed languages (list)
Submissions from external services are filtered by IP address, so only submissions from IP addresses associated with a service are accepted. This works because third-party services will typically route translations through a gateway that resides at a static IP address.
Special Cases
We are also implementing direct support for a few specific service providers, including: