mapbox-navigation-ios icon indicating copy to clipboard operation
mapbox-navigation-ios copied to clipboard

Can't set custom locale and distanceMeasurementSystem in route options

Open JanetKao opened this issue 5 years ago • 4 comments

  1. Setting Langeage Chinese ,it always speaks English. routeOptions.includesSteps = true routeOptions.includesSpokenInstructions = true routeOptions.locale = Locale(identifier: "zh-Hans") 2.If I set langeage , unit can't change KM and MILE. routeOptions.includesSpokenInstructions = true routeOptions.includesSteps = true routeOptions.distanceMeasurementSystem = usesMetric ? .metric : .imperial

JanetKao avatar Jan 18 '21 03:01 JanetKao

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 21 '21 02:07 stale[bot]

This is probably due to https://github.com/mapbox/mapbox-navigation-ios/blob/19b637deac80f9240dd846e7ccb8b517e88e0fa5/MapboxCoreNavigation/NavigationRouteOptions.swift#L135-L136

I'm trying to find out the reason for this code.

S2Ler avatar Aug 20 '21 08:08 S2Ler

I don’t think that code is at issue. It only gets called in the initializer of NavigationRouteOptions, but it looks like the code above is setting the measurement system after initialization.

1ec5 avatar Aug 20 '21 15:08 1ec5

Setting Langeage Chinese ,it always speaks English.

The problem is that zh-Hans is a written locale (Simplified Chinese) while the Voice API expects a spoken locale of cmn-CN (Mandarin in Mainland China). The Directions API doesn’t realize that Simplified Chinese text can be used for Mandarin text-to-speech, so it returns English instructions. mapbox/locale-utils#7 tracks adding a fallback from Mandarin to Chinese to fix this issue on the server side.

1ec5 avatar Aug 20 '21 15:08 1ec5