用户会在各地以多种语言沟通。与非响应式代理相比,能够适应用户的沟通偏好并为其提供本地化体验的代理可覆盖更多用户、打造更有吸引力的用户体验并促成更多反复互动。借助 Business Messages,代理和营业地点能够通过以下方式适应用户的偏好:将用户语言区域设置传给代理,让代理能够指定默认语言区域并为每个语言区域指定唯一的对话设置,并且解析用户语言区域与代理或营业地点支持的语言区域之间的匹配项。
[null,null,["最后更新时间 (UTC):2024-09-10。"],[[["\u003cp\u003eBusiness Messages supports localization, enabling agents to tailor interactions based on user location and language preferences for a better user experience.\u003c/p\u003e\n"],["\u003cp\u003eUser device locale, identified through \u003ccode\u003euserDeviceLocale\u003c/code\u003e, informs the platform's language and interface adjustments and can be used by agents for personalized responses.\u003c/p\u003e\n"],["\u003cp\u003eAgents and locations can define conversational settings for various locales and set a default locale using the Business Communications Developer Console or API.\u003c/p\u003e\n"],["\u003cp\u003eBusiness Messages resolves a locale match between the user and agent, indicated by \u003ccode\u003eresolvedLocale\u003c/code\u003e, influencing displayed conversational elements and strings.\u003c/p\u003e\n"],["\u003cp\u003eAgents should monitor locale changes within a conversation and potentially adapt their communication accordingly to ensure a consistent and user-friendly experience.\u003c/p\u003e\n"]]],[],null,["# Localization and locales\n\n| Choose whether to manage agents with the Business Communications [Developer\n| Console](https://business-communications.cloud.google.com?utm_source=/business-communications/business-messages/guides/how-to/agents/localization&utm_medium=devsite&utm_campaign=business-messages) or [API](/business-communications/business-messages/reference/business-communications/rest). \n| Developer Console API\n\nUsers communicate from many locations and in many languages. Agents that are\nresponsive to users' communication preferences and localize their experiences\nreach more users, create more fulfilling user experiences, and drive more\nrepeat interactions than agents that aren't responsive. Business Messages\nenables agents and locations to be responsive to users' preferences by passing\nuser locale settings to agents, enabling agents to specify a default locale and\nunique conversational settings per locale, and resolving matches between users'\nlocales and an agent or location's supported locales.\n\nBy detecting locale, Business Messages agents can localize their experiences by\nmaking automated and live agent interactions aware of users' region and\nlanguage preferences.\n\nUser locale\n-----------\n\nWhen a user begins a conversation with an agent, and each time a user sends a\nmessage, Business Messages detects the user device's locale settings. Each\nmessage agents receive includes the user's locale in the\n[`context.userInfo.userDeviceLocale`](/business-communications/business-messages/reference/rest/v1/Context#UserInfo)\nfield.\n\nBusiness Messages uses the user device's locale to change the language in the\nuser interface and change the language of strings generated by the platform.\n\n`userDeviceLocale` can change within a conversation if the user changes the\ndevice's language or switches between devices that have different locale\nsettings. If agents read `userDeviceLocale`, they should check if the value has\nchanged with each new message and adapt accordingly if it has. For example, an\nagent might detect a locale change and ask the user if they would prefer to\ncontinue communicating in the current language or switch to one that matches the\nnew locale.\n\n`userDeviceLocale` is specified by the user's device and can be any [IETF BCP\n47](https://tools.ietf.org/html/bcp47) language tag.\n\nAgent and location locale\n-------------------------\n\nAgents and locations can specify conversational settings for whichever locales\nthey support. For example, an agent might specify a welcome message in English\nfor the \"en\" locale and have the same message in Spanish for the \"es\" locale, or\none location may specify settings for the \"fr\" locale while another location\ndoesn't.\n\nIf an agent or location has any conversational settings set for a locale,\nBusiness Messages assumes that the agent or location supports that locale.\nAgents and locations can set a default locale (`defaultLocale`) that they\nusually communicate in.\n\nTo update an agent or location's default locale, see [Update the default\nlocale](#update-default-locale). To set conversational settings for a locale,\nsee [Begin the\nconversation](/business-communications/business-messages/guides/how-to/agents/begin-conversation).\n\nResolved locale\n---------------\n\nBy identifying the user device's locale and comparing that locale to the locales\nspecified for the agent or the location that the user messages, Business\nMessages can resolve a match between the user and agent locales. An agent or\nlocation's `defaultLocale` takes precedence over other supported locales when\nBusiness Messages resolves a match. Each message agents receive includes this\nmatch in the\n[`context.resolvedLocale`](/business-communications/business-messages/reference/rest/v1/Context)\nfield.\n\nBusiness Messages uses the resolved locale to select which conversational\nsettings (such as welcome messages and offline messages) and strings (such as\nthe [Live agent request suggestion](/business-communications/business-messages/guides/how-to/message/send#live_agent_request_suggestion)\nstring) to display. It's best practice for agents to communicate in the resolved\nlocale to maintain a consistent user experience.\n\nThe resolved locale can change within a conversation if the user changes the\ndevice's language or switches between devices that have different locale\nsettings. Agents should check if the value has changed with each new message and\nadapt accordingly if it has. For example, an agent might detect a locale change\nand ask the user if they would prefer to continue communicating in the current\nlanguage or switch to one that matches the new locale.\n\nUpdate the default locale\n-------------------------\n\n| **Note:** To update a location's default locale, [use the Business Communications\n| API](/business-communications/business-messages/guides/how-to/agents/localization?method=api#update-default-locale).\n\nTo update an agent's default locale,\n\n1. Open the [Business Communications Developer\n Console](https://business-communications.cloud.google.com?utm_source=/business-communications/business-messages/guides/how-to/agents/localization&utm_medium=devsite&utm_campaign=business-messages) and sign in with your Business Messages Google account.\n2. Choose your agent.\n3. In the left navigation, click **Agent information**.\n4. For **Locale** , choose the two-character [ISO 639-1 language\n code](http://www.loc.gov/standards/iso639-2/php/code_list.php) that corresponds to the new default locale.\n5. If necessary, update the agent's [conversational\n settings](/business-communications/business-messages/guides/how-to/agents/begin-conversation) to match the new locale.\n6. Click **Save**."]]