Home > Software design >  How do I select a language in OSRM's RoadManager
How do I select a language in OSRM's RoadManager

Time:02-24

I need to force OSRM to switch the language in road.mNodes.mInstructions to English in order to work with English TTS. How do I achieve that in Kotlin? I'm using OSRMRoadManager from OSMBonusPack.

CodePudding user response:

I don't see an obvious answer. Basically, you need to change the way DIRECTIONS hashmap is initialized.

Suggestion : you could subclass OSRMRoadManager, adapting buildInstructions(int maneuver, String roadName), to use your own DIRECTIONS object.

If you see a simple change to do inside the lib (adding a "language" option somewhere), don't hesitate to push a PR.

CodePudding user response:

Thanks for the quick response MKer! I've actually managed to find a workaround which suits my needs, without needing to subclass OSRMRoadManager and all that. For anyone with the same problem - I've switched the language using Locale, as shown here. Nevertheless, I think it's probably something that should be in OSMBonusPack as an option, in case one wants to preserve the default language in some other parts of the app. I can try looking into the lib myself.

  • Related