Skip to content

JioMeet/JioTranslateCoreSDK_Android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 

Repository files navigation

JioTranslateCoreSDK_Android

JioTranslate is a package that provides functionality for translating text and speech between different languages. It offers features like text translation, text to speech, and speech to text.

JioTranslate CoreSDK Quickstart

Table of Contents

  1. Introduction
  2. Features
  3. Prerequisites
  4. Project Settings
  5. Integration Steps
  6. Data classes and enums

Introduction

In this documentation, we'll guide you through the process of installation, Let's get started on your journey to Break Language barriers with translation of any language into your native tongue with JioTranslate CoreSDK!


Features

In JioTranslate Core SDK, you'll find a range of powerful features designed to enhance your iOS application's translation needs. These features include:

  1. Speech to Text Translation: Experience seamless conversion of spoken language into written text.

  2. Text to Text Translation: Effortlessly translate text from one language to another.

  3. Text to Speech Translation: Transform written text into spoken language.

Prerequisites

Before getting started with this example app, please ensure you have the following software installed on your machine:

  • Android Studio
  • Support for Java 11

Project Settings

Configure JioMeet Core SDK inside your app

i.: Generate a Personal Access Token for GitHub

  • Settings -> Developer Settings -> Personal Access Tokens -> Generate new token
  • Make sure you select the following scopes (“ read:packages”) and Generate a token
  • After Generating make sure to copy your new personal access token. You cannot see it again! The only option is to generate a new key.

ii. Update build.gradle inside the application module

    repositories {
    maven {
        credentials {
            <!--github user name-->
                username = ""
            <!--github user token-->
                password = ""
        }
        url = uri("https://maven.pkg.github.com/JioMeet/JioTranslateCoreSDK_Android")
    }
    google()
    mavenCentral()
}

iii. In Gradle Scripts/build.gradle (Module: ) add the CORE SDK dependency. The dependencies section should look like the following:

dependencies {
    ...
    implementation " com.jio.translation.jiomeetcoretranslationsdk:<version>"
    ...
}

Find the Latest version of the Core SDK and replace with the one you want to use. For example: 1.0.0.

Add permissions for network and device access.

In /app/Manifests/AndroidManifest.xml, add the following permissions after :

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"

Integrate SDK

Create and configure the instance of JioTranslateManager.

        val builder = JioTranslate.Builder()
        builder.apply {
            init(context, Server.SIT.baseURL)
            setJwt(accessToken)
            setUserId("userId")
        }
        jioTranslate = builder.build()
    

Load Configuration

This method fetches the configuration data required for the SDK to function properly. Upon successful loading, it returns the list of supported languages as a List. This list serves as the source of truth for the supported languages within the SDK.

jioTranslate.loadConfig { result ->
        when (result) {
            is Completion.Success -> {
                _listOfLanguages.value = jioTranslate.getListOfSupportedLanguage()
            }
            is Completion.Error -> {
                Log.e("TAG", "initJioTranslate: " + "Error fetching config")
            }
        }
    }

Speech to Text Translation

Use this function to convert spoken language into written text.

 fun startSpeechToText(
        audioFilePath : String,
        inputLanguage : String,
        translateEngine : TranslateEngineType? = null,
        completion : (Completion<Any>) -> Unit,
    ) 
Property Name Type Description
audioFilePath String Send recorded audio file path (Ex: recorded.wav)
inputLanguage String Language name of the recorded audio, Ex: 'English', 'Telugu'
translateEngine TranlsateEngineType TRANSLATE_ENGINE_1, TRANSLATE_ENGINE_2, TRANSLATE_ENGINE_3
completion Completion The Completion class represents the outcome of an operation, encapsulating either a successful result as String or an error of type JioTranslateApiError.

Text to Text Translation

Use this function to translate text from one language to another.

  suspend fun startTextTranslate(
        inputText : String,
        inputLanguage : String,
        translationLanguage : String,
        translateEngine :  TranslateEngineType? = null,
        isIndirectTranslation : Boolean = false,
        completion : (Completion<Any>) -> Unit,
    ) 
Property Name Type Description
inputText String Input text to translate
inputLanguage String Language name of the input text, Ex: 'English', 'Telugu'
translationLanguage String Language name of the output translation text, Ex: 'Hindi', 'Telugu'
translateEngine TranlsateEngineType TRANSLATE_ENGINE_1, TRANSLATE_ENGINE_2, TRANSLATE_ENGINE_3
isIndirectTranslation Bool true or false
completion Completion The Completion class represents the outcome of an operation, encapsulating either a successful result of type String or an error of type JioTranslateApiError.

Text to Speech Translation

Use this function to translate written text into spoken language.

suspend fun startTextToSpeech(
        inputText : String,
        gender: Gender,
        translateEngine :  TranslateEngineType? = null,
        textSupportedLanguage : String,
        completion : (Completion<Any>) -> Unit,
    )
Property Name Type Description
inputText String Input text to translate
textSupportedLanguage String Language name of the input text, Ex: 'English', 'Telugu'
translateEngine TranlsateEngineType TRANSLATE_ENGINE_1, TRANSLATE_ENGINE_2, TRANSLATE_ENGINE_3
gender Gender MALE or FEMALE
completion Completion The Completion class represents the outcome of an operation, encapsulating either a successful result of type String or an error of type JioTranslateApiError.

Data classes and Enums

JioTranslateApiError

JioTranslateApiError is a sealed class representing various types of errors that can occur during translation. It has the following subclasses:

 - UnsupportedLanguage: Indicates that the language is not supported for translation.
 - Unauthorized: Indicates that the user is not authorized to perform the translation.
 - ServerError: Indicates a server error occurred during translation.
 - GenericError: Indicates a generic error occurred during translation.

Troubleshooting

Facing any issues while integrating or installing the JioTranslate android CoreSDK kit, please connect with us via real time support present in [email protected] or https://translate.jio/contact-us.html