mapbox / mapbox/mapbox-navigation-android

VoiceSpeech get English announcement when I set chinese language

Open
#5,048 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

jira-sync-complete
Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

I use this example to test(https://github.com/mapbox/mapbox-navigation-android/blob/main/examples/src/main/java/com/mapbox/navigation/examples/core/MapboxVoiceActivity.kt)

I set the language to SIMPLIFIED_CHINESE.
When the network is connected, the speechCallback get chinese announcement.
But I turn off the network, speechCallback get English announcement.

```
private val speechApi: MapboxSpeechApi by lazy {
MapboxSpeechApi(this, getMapboxAccessTokenFromResources(), Locale.SIMPLIFIED_CHINESE.language)
}

private val voiceInstructionsPlayer: MapboxVoiceInstructionsPlayer by lazy {
MapboxVoiceInstructionsPlayer(
this,
getMapboxAccessTokenFromResources(),
Locale.SIMPLIFIED_CHINESE.language
)
}

val routeOptions: RouteOptions = RouteOptions.builder()
.applyDefaultNavigationOptions()
.applyLanguageAndVoiceUnitOptions(this)
.language(Locale.getDefault().language)
.coordinatesList(listOf(origin, destination))
.voiceInstructions(true)
.build()

private val speechCallback =
MapboxNavigationConsumer> { expected ->
expected.fold(
{ error ->
// The data obtained in the form of an error is played using
// voiceInstructionsPlayer.
voiceInstructionsPlayer.play(
error.fallback,
voiceInstructionsPlayerCallback
)
},
{ value ->
// The data obtained in the form of speech announcement is played using
// voiceInstructionsPlayer.
voiceInstructionsPlayer.play(
value.announcement,
voiceInstructionsPlayerCallback
)
}
)
}
```
**Mapbox Navigation SDK version:mapbox-navigation-android-2.0.0-rc.1**

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/src/main/java/com/mapbox/navigation/examples/core/MapboxVoiceActivity.kt and trace speechCallback when the network is unavailable. Compare the configured SIMPLIFIED_CHINESE language with the fallback passed to voiceInstructionsPlayer.play. Done means offline speech announcements remain Chinese rather than switching to English.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.