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.
2 Answers
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.

- 33
- 1
- 6
-
You don't need to post this as another answer to the question. To respond to the person who answered, you can put it up as a comment on the answer. You can have this answer (which actually is a comment/reply) deleted. – Pradipta Sarma Feb 24 '22 at 05:07
-
Thanks for the tip, I'm new here. My answer does actually contain the answer to my question, though. I can edit it and delete the first sentence and in my opinion it should be classified as an answer. – tymwitko Feb 24 '22 at 15:44
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.

- 3,430
- 1
- 13
- 18