diff --git a/bot/admin/web/src/app/core-nlp/state.service.ts b/bot/admin/web/src/app/core-nlp/state.service.ts index 3f834f0692..62eb56d1ee 100644 --- a/bot/admin/web/src/app/core-nlp/state.service.ts +++ b/bot/admin/web/src/app/core-nlp/state.service.ts @@ -81,7 +81,7 @@ export class StateService implements AuthListener { } static normalizeLocaleCode(code: string): string { - return code.split('_')[0]; + return code ? code.split(/[-_]/)[0] : code; } constructor(private auth: AuthService, private settings: SettingsService) { diff --git a/bot/connector-rest-client/src/main/kotlin/ConnectorRestClient.kt b/bot/connector-rest-client/src/main/kotlin/ConnectorRestClient.kt index f68dcd1629..ca3eaee8b2 100644 --- a/bot/connector-rest-client/src/main/kotlin/ConnectorRestClient.kt +++ b/bot/connector-rest-client/src/main/kotlin/ConnectorRestClient.kt @@ -76,6 +76,6 @@ class ConnectorRestClient( locale: Locale, query: ClientMessageRequest, ): Response { - return getService(path).talk(locale, query).execute() + return getService(path).talk(locale.toLanguageTag(), query).execute() } } diff --git a/bot/connector-rest-client/src/main/kotlin/ConnectorRestService.kt b/bot/connector-rest-client/src/main/kotlin/ConnectorRestService.kt index a424efb064..9b1cf09037 100644 --- a/bot/connector-rest-client/src/main/kotlin/ConnectorRestService.kt +++ b/bot/connector-rest-client/src/main/kotlin/ConnectorRestService.kt @@ -30,7 +30,7 @@ import java.util.Locale interface ConnectorRestService { @POST("{locale}") fun talk( - @Path("locale") locale: Locale, + @Path("locale") locale: String, @Body request: ClientMessageRequest, ): Call } diff --git a/bot/connector-rest/src/main/kotlin/RestConnector.kt b/bot/connector-rest/src/main/kotlin/RestConnector.kt index 0a6b775568..b5c1572e22 100644 --- a/bot/connector-rest/src/main/kotlin/RestConnector.kt +++ b/bot/connector-rest/src/main/kotlin/RestConnector.kt @@ -205,4 +205,4 @@ class RestConnector( else -> getTargetConnector(targetConnectorType)?.toConnectorMessage(message)?.invoke(this) ?: emptyList() } } -} +} \ No newline at end of file