Skip to content

Commit

Permalink
Merge branch 'master' of github.com:DevnagriAI/android-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshgaur committed Dec 6, 2022
2 parents f988957 + 1629cfd commit bcccb85
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Add the below dependency in your app build.gradle file:

...
implementation ('com.github.DevnagriAI:android-sdk:1.1.0@aar') { transitive(true) }
implementation ('com.github.DevnagriAI:android-sdk:1.1.3@aar') { transitive(true) }
}
Expand All @@ -41,11 +41,11 @@ Initialise the SDK in your application class and add the API_KEY from DevNagri.
override fun onCreate() {
super.onCreate()
val syncTime:Int = 10 //In minutes
val syncTime:Int = 60 //In minutes
val strings = R.string::class.java.fields.map { it.name }
val arrays = R.array::class.java.fields.map { it.name }
val plurals = R.plurals::class.java.fields.map { it.name }
val strings = R.string::class.java.fields
val arrays = R.array::class.java.fields
val plurals = R.plurals::class.java.fields
// passing arrays and plurals in init method is optional here, pass them only if defined in strings.xml file
DevNagriTranslationSdk.init(applicationContext, "API_KEY" ,syncTime, strings, arrays, plurals, initListener = {isInitialized, error ->
Expand All @@ -71,10 +71,13 @@ Additionally, you need to inject the SDK in each activity, e.g. by creating a ba
# Change Language

In case you don't want to use the system language, you can set a different language in the updateAppLocale method. The language code (locale) needs to be present in a release from Devnagri.
updateAppLocale function may take some time (for example: 3-4 seconds), we suggest you to add a loader before calling updateAppLocale and stop in callback.


val locale = Locale("hi");
DevNagriTranslationSDK.updateAppLocale(activityContext , locale);
//Start loader here
val locale = Locale("hi");
DevNagriTranslationSdk.updateAppLocale(this,locale, completionHandler = {isCompleted, error ->
//Stop loader here
})

Please note that you will get the english text back if your device language is english or you have not set any specific language for the SDK. To get the translation in Hindi, Please update app locale to Hindi as per above method.

Expand Down Expand Up @@ -135,9 +138,9 @@ You can use these methods anywhere in your project and these will provide transl
- If you have multiple modules in your application,
then in each module's base activity override the below method.

override fun getDelegate(): AppCompatDelegate {
return DevNagriTranslationSdk.fetchAppDelegate(this, super.getDelegate())
}
override fun getDelegate(): AppCompatDelegate {
return DevNagriTranslationSdk.fetchAppDelegate(this, super.getDelegate())
}

# Usage

Expand Down
Binary file modified android-sdk.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
install:
- FILE="-Dfile=android-sdk.aar"
- mvn install:install-file $FILE -DgroupId=com.github.DevnagriAI -DartifactId=android-sdk -Dversion=1.1.0 -Dpackaging=aar -DpomFile=pom.xml
- mvn install:install-file $FILE -DgroupId=com.github.DevnagriAI -DartifactId=android-sdk -Dversion=1.1.3 -Dpackaging=aar -DpomFile=pom.xml
jdk:
- openjdk11
before_install:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.DevnagriAI</groupId>
<artifactId>android-sdk</artifactId>
<version>1.1.0</version>
<version>1.1.3</version>
<!-- <packaging>aar</packaging>-->
<dependencies>
<dependency>
Expand Down

0 comments on commit bcccb85

Please sign in to comment.