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:
- Start Android Studio and close any open Android Studio projects.
- From the Android Studio menu, select File > New > Import Project.
- Select the VocaDBTranslator project folder with the AndroidManifest.xml file and click Ok.
- Select the destination folder and click Next.
- Select the import options and click Finish.
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.
Other dependency libraries are also included in the file.
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 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.
The app allows manual selection of source languages (slang) and target languages (tlang) to be included in the language drop-down list.
One of the revolutionary features of the app is that it can automatically extract words and idioms from an input text.
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.
The app allows manual selection of search engine to be used, whether Google or MS Bing.
Color enhances user experience. The app allows personalization of the text color based on preference.
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.
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
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.
Also, don't forget to add
UTF-8 encoding type to the request.
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
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
For more information about the API, click the button below:
Translator API Documentation
Download the App!
Back to top