Closed Fabilin closed 2 days ago
why not using bus#userPreferences.locale ? Is this solving the issue ?
I would say that the best fix would be to change in TockBotBus
override val userLocale: Locale =
by
override val userLocale: Locale get() =
This is already done in BotBusMock, and I think perf cost is ok
A somewhat common request in a multilingual bot is for the bot to "switch language", where the user expects the bot to start talking in the language of their choice. As far as I know, the typical way to perform this operation is to set the user's locale as follows:
However this change is only taken into account the next time a
TockBotBus
is created, which means the answer to the "switch language" intent is improperly translated:A simple fix for this would be to make the
BotBus#userLocale
field mutable, and add a way to simultaneously set the locale in both the bus and the UserPreferences.