vocaDB Translator

Available translators are limited to the basic task of translating a text from one language to another. That's why VocaDB Translator added a revolutionary function.
Aside from basic translation function, our Translation app is capable of generating a list of words and idioms extracted from an input text. It also provides vocabulary information relevant to language learners.
The app supports 38 languages. It is powered by VocaDB's Translation with Word Extraction API and the APIs of Google Translate and MS Bing.
 
This document is intended for developers who want to build mobile apps that can interact with our APIs.
 
All the best and enjoy coding.
To begin, you need to set up:
 
This app has been developed using Android Studio 2.1. It uses:
 
  • Android SDK 6.0, API Level 23 for Compiling
  • Android SDK 4.1, API Level 16 as Minimum SDK version
 
VocaDB Translator app is compatible with Andriod 4.1 (Jelly Bean) and up.
 
For more information about the configurations of the app, please check the build.gradle file under vocaDBTranslator/app.
This section provides steps on how to import and run VocaDB Translator app on your workspace.

Importing and Running the Application

To import the project to Android Studio:
  1. Start Android Studio and close any open Android Studio projects.
  2. From the Android Studio menu, select File > New > Import Project.
  3. Select the VocaDBTranslator project folder with the AndroidManifest.xml file and click Ok.
  4. Select the destination folder and click Next.
  5. Select the import options and click Finish.
 

Libraries

The app uses the AQuery library for doing asynchronous tasks and manipulating UI elements. Include the .jar file vocaDBTranslator/app/libs.
 
 
Also, add the compile dependency in build.gradle file.
compile files('libs/android-query-full.0.26.8.jar')
 
Other dependency libraries are also included in the file.
 

Project Structure

The app contains one or more modules with source code files and resource files. 
 
 
The adapters folder
 
This folder contains objects for making a View for each item in the data. 
 
The base folder
 
This folder contains classes where other subclasses are derived. 
 
The broadcastreceivers folder
 
This folder contains classes that broadcast messages from other applications or from the system itself. 
 
The databasehelpers folder
 
This folder contains classes that manage database creation and version management. 
 
The helpers folder
 
This folder contains classes that provide functionalities for other classes within the app.
 
The models folder
 
This folder contains classes that model the objects associated with creating, reading, updating, and deleting.
 
The parsers folder
 
This folder contains classes that is used for parsing JSON response. 
 
The utilities folder
 
This folder contains classes that define a set of methods which perform common, often re-used functions (static).
 
The views folder
 
This folder contains classes that represent the basic building block of user interface components.
 

The following graphics illustrate how data flow when you start the app:

 


  • Splash Screen

  • Main Screen

  • Translation Results Screen

  • Word List Extraction Screen

  • Idiom List Extraction Screen

  • Google Browser Screen

  • MS Bing Browser Screen

Translation

The basic function of VocaDB Translator app is to translate words or text to a specified language. English is the default language of the input text (source language or slang) and the search result (target language or tlang) but they can be set to another language.

The app also has a language switcher button that allows 2-way text translation.

 

Language Selection

The app allows manual selection of source languages (slang) and target languages (tlang) to be included in the language drop-down list.

 

Extraction

One of the revolutionary features of the app is that it can automatically extract words and idioms from an input text.

 

Level Selection

The app has an English level selection which filters the words and idioms to be extracted from a text as well as their corresponding definitions.

If elementary level is selected, for example, it will only extract words and idioms for elementary language learners.

The app will extract with no filter if nothing is selected.

 

Engine Selection

The app allows manual selection of search engine to be used, whether Google or MS Bing.

 

Color Customization

Color enhances user experience. The app allows personalization of the text color based on preference.

 

History

The app also shows the list of previously searched words and text.

 
The Translator API allows developers to make requests and get responses in JSON format.
 

API Key

The API key for this app is defined in app/your_app_package_name/base/Constants.java.
// API Keys
public static final String TRANSLATOR_API_KEY = "YOUR_API_KEY";
 

Apply for API Key

URLs

All URLs are defined also in app/your_app_package_name/base/Constants.java.
// API URLs
public static final String BASE_URL = "http://www.vocadb.com/v2_dic/";
public static final String TRANSLATOR_API_URL = BASE_URL + "api_vocadb_trans.php";
 
It is important to add the custom header named x-voca-apikey, along with your API key.
httpPost.addHeader("x-voca-apikey", YOUR_API_KEY);
 
Also, don't forget to add UTF-8 encoding type to the request.
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));

Parameters

The parameters needed to make a request are:
  • q - Query parameter to identify the string to translate and extract
  • slang - Source language reference
  • tlang - Target language reference
  • engin - Search engine to be used (Google Translate/MS Bing)
  • d - Direction, 1 = mobile

Sample Request

http://www.vocadb.com/v2_dic/api_translation.php?apikey=3065&engin=0&slang=en&tlang=ko&q=The+late-2000s+financial+crisis+%28often+called+the+global+recession+%2C+global+financial+crisis+or+the+credit+crunch+%29+is+considered+by+many+economists+to+be+the+worst+financial+crisis+since+the+Great+Depression+of+the+1930s.+It+resulted+in+the+collapse+of+large+financial+institutions%2C+the+bailout+of+banks+by+national+governments+and+downturns+in+stock+markets+around+the+world.
 
For more information about the API, click the button below:
 

Translator API Documentation

Download the App!
Get it on Google Play
 

© vocaDB. All rights reserved.