执行切换到 phone 时控制用户语言环境的是什么
What controls user locale when performing handover to phone
我目前正在使用 Actions on Google SDK 以及 Microsoft 的 Bot Framework 来处理一个动作。在此操作中,我构建了一个后备方案,允许用户在他们的 phone 上输入产品代码(如果他们通过语音失败了几次)。此设置在英语中运行良好,但我的操作是多语言的,也支持荷兰语和法语。
我 运行 遇到的问题是,当用户使用荷兰语或法语执行我的操作时,当他们同意将对话移至他们的 phone 时,对话继续使用英语一旦出现在我的 phone 上。您可以在下面找到我在处理程序中使用的代码。
新表面处理程序
endpoint.intent(GoogleIntentTypes.NewSurface, async (conv: ActionsSdkConversation) => {
logger.logDebug("Received new surface request")
const locale = conv.user.locale;
if (conv.arguments!.get('NEW_SURFACE')!.status! === 'OK') {
conv.ask(this.messages.getResponse("AskForProductNumber_SSML", locale));
} else {
conv.close(this.messages.getResponse("EndConversation_SSML", locale));
};
});
从请求进入我的 webhook 的那一刻起,我的对话区域设置就切换到了 en-US。这让我觉得语言环境是从我的 phone 上的设置中获取的,但我在文档中找不到任何相关内容。有谁知道在执行切换到 phone 时可能导致语言环境切换的原因?
我的理解是语言环境是基于发送请求的设备的语言环境。
This page on "languages and locales"(强调我的)说:
Locales are constructed using the language set in the Assistant settings and the region set in the device settings. The combination of these needs to form a supported locale. For example, a device set to the BR region and an Assistant device set to en-US results in a en-BR locale, which is not supported by Actions on Google.
我目前正在使用 Actions on Google SDK 以及 Microsoft 的 Bot Framework 来处理一个动作。在此操作中,我构建了一个后备方案,允许用户在他们的 phone 上输入产品代码(如果他们通过语音失败了几次)。此设置在英语中运行良好,但我的操作是多语言的,也支持荷兰语和法语。
我 运行 遇到的问题是,当用户使用荷兰语或法语执行我的操作时,当他们同意将对话移至他们的 phone 时,对话继续使用英语一旦出现在我的 phone 上。您可以在下面找到我在处理程序中使用的代码。
新表面处理程序
endpoint.intent(GoogleIntentTypes.NewSurface, async (conv: ActionsSdkConversation) => {
logger.logDebug("Received new surface request")
const locale = conv.user.locale;
if (conv.arguments!.get('NEW_SURFACE')!.status! === 'OK') {
conv.ask(this.messages.getResponse("AskForProductNumber_SSML", locale));
} else {
conv.close(this.messages.getResponse("EndConversation_SSML", locale));
};
});
从请求进入我的 webhook 的那一刻起,我的对话区域设置就切换到了 en-US。这让我觉得语言环境是从我的 phone 上的设置中获取的,但我在文档中找不到任何相关内容。有谁知道在执行切换到 phone 时可能导致语言环境切换的原因?
我的理解是语言环境是基于发送请求的设备的语言环境。
This page on "languages and locales"(强调我的)说:
Locales are constructed using the language set in the Assistant settings and the region set in the device settings. The combination of these needs to form a supported locale. For example, a device set to the BR region and an Assistant device set to en-US results in a en-BR locale, which is not supported by Actions on Google.