Skip to content

Commit

Permalink
Show transliteration for Lingva if available (closes #118)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnyro committed Dec 26, 2022
1 parent 23e4e71 commit dc58f99
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/com/bnyro/translate/api/lv/LVEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class LVEngine : TranslationEngine(
return Translation(
translatedText = URLHelper.decodeURL(response.translation),
detectedLanguage = response.info?.detectedSource,
transliterations = listOf(response.info?.pronunciation?.query).filterNotNull(),
examples = response.info?.examples,
similar = response.info?.similar,
definitions = response.info?.definitions
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/bnyro/translate/obj/Translation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.bnyro.translate.obj
data class Translation(
val translatedText: String,
val detectedLanguage: String? = null,
val transliterations: List<String>? = null,
val definitions: List<Definition>? = null,
val similar: List<String>? = null,
val examples: List<String>? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ fun AdditionalInfoComponent(
)
}
}
translation.transliterations?.let {
items(it) {
AdditionalInfo(
title = stringResource(R.string.transliteration),
text = it
)
}
}
translation.definitions?.let {
items(it) {
AdditionalInfo(
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<string name="definition">Definition</string>
<string name="example">Example</string>
<string name="similar">Similar</string>
<string name="transliteration">Transliteration</string>
<!-- Languages -->
<string name="search">Search</string>
</resources>

0 comments on commit dc58f99

Please sign in to comment.