The IBM Watson™ Language Translator service provides an Application Programming Interface (API) that lets you identify the language of text, and then use a custom business domain to translate the text from one supported language to another.
You can translate either by letting the service identify the source language or by selecting a source language and then by selecting a target language, and a business domain. Domain translation is linguistically targeted these business domains:
- The News domain - targeted at news articles and transcripts, it translates English to and from Arabic, Brazilian Portuguese, French, Italian, or Spanish. It also translates Spanish to and from French.
- The Conversational domain - targeted at conversational colloquialisms, it translates English to and from Arabic, Brazilian Portuguese, French, Italian, or Spanish.
- The Patent domain - targeted at technical and legal terminology, it translates Brazilian Portuguese, Chinese, or Spanish to English.
Give it a try! Click the button below to fork into IBM DevOps Services and deploy your own copy of this application on IBM Cloud.
-
You need an IBM Cloud account. If you don't have one, sign up. Experimental Watson Services are free to use.
-
Download and install the Cloud-foundry CLI tool if you haven't already.
-
Edit the
manifest.yml
file and change<application-name>
to something unique. The name you use determines the URL of your application. For example,<application-name>.mybluemix.net
.applications: - services: - language-translator-service name: <application-name> command: node app.js path: . memory: 128M
-
Connect to IBM Clod with the command line tool.
cf api https://api.ng.bluemix.net
cf login
-
Create the Language Translator service in the IBM Cloud.
cf create-service language_translator lite language-translator-service cf create-service-key language-translator-service myKey cf service-key language-translator-service myKey
-
Create a
.env
file in the root directory by copying the sample.env.example
file using the following command:
cp .env.example .env
You will update the .env
with the information you retrieved in steps 5.
The .env
file will look something like the following:
LANGUAGE_TRANSLATOR_USERNAME=<username>
LANGUAGE_TRANSLATOR_PASSWORD=<password>
LANGUAGE_TRANSLATOR_URL=<url>
- Install the dependencies you application need:
npm install
- Start the application locally:
npm start
-
Point your browser to http://localhost:3000.
-
Optional: Push the application to IBM Cloud:
cf push
After completing the steps above, you are ready to test your application. Start a browser and enter the URL of your application.
<your application name>.mybluemix.net
For more details about developing applications that use Watson Developer Cloud services in the IBM Cloud, see Getting started with Watson Developer Cloud and IBM Cloud.
-
The main source of troubleshooting and recovery information is the IBM Cloud log. To view the log, run the following command:
$ cf logs <application-name> --recent
-
For more details about the service, see the documentation for the Language Translator.
This sample code is licensed under Apache 2.0. Full license text is available in LICENSE. This sample code is using jQuery which is licensed under MIT. This sample code is using bootstrap which is licensed under MIT.
See CONTRIBUTING.
Find more open source projects on the IBM Github Page