Localization and locales

Users communicate from many locations and in many languages. Agents that are responsive to users' communication preferences and localize their experiences reach more users, create more fulfilling user experiences, and drive more repeat interactions than agents that aren't responsive. Business Messages enables agents and locations to be responsive to users' preferences by passing user locale settings to agents, enabling agents to specify a default locale and unique conversational settings per locale, and resolving matches between users' locales and an agent or location's supported locales.

By detecting locale, Business Messages agents can localize their experiences by making automated and live agent interactions aware of users' region and language preferences.

User locale

When a user begins a conversation with an agent, and each time a user sends a message, Business Messages detects the user device's locale settings. Each message agents receive includes the user's locale in the context.userInfo.userDeviceLocale field.

Business Messages uses the user device's locale to change the language in the user interface and change the language of strings generated by the platform.

userDeviceLocale can change within a conversation if the user changes the device's language or switches between devices that have different locale settings. If agents read userDeviceLocale, they should check if the value has changed with each new message and adapt accordingly if it has. For example, an agent might detect a locale change and ask the user if they would prefer to continue communicating in the current language or switch to one that matches the new locale.

userDeviceLocale is specified by the user's device and can be any IETF BCP 47 language tag.

Agent and location locale

Agents and locations can specify conversational settings for whichever locales they support. For example, an agent might specify a welcome message in English for the "en" locale and have the same message in Spanish for the "es" locale, or one location may specify settings for the "fr" locale while another location doesn't.

If an agent or location has any conversational settings set for a locale, Business Messages assumes that the agent or location supports that locale. Agents and locations can set a default locale (defaultLocale) that they usually communicate in.

To update an agent or location's default locale, see Update the default locale. To set conversational settings for a locale, see Begin the conversation.

Resolved locale

By identifying the user device's locale and comparing that locale to the locales specified for the agent or the location that the user messages, Business Messages can resolve a match between the user and agent locales. An agent or location's defaultLocale takes precedence over other supported locales when Business Messages resolves a match. Each message agents receive includes this match in the context.resolvedLocale field.

Business Messages uses the resolved locale to select which conversational settings (such as welcome messages and offline messages) and strings (such as the Live agent request suggestion string) to display. It's best practice for agents to communicate in the resolved locale to maintain a consistent user experience.

The resolved locale can change within a conversation if the user changes the device's language or switches between devices that have different locale settings. Agents should check if the value has changed with each new message and adapt accordingly if it has. For example, an agent might detect a locale change and ask the user if they would prefer to continue communicating in the current language or switch to one that matches the new locale.

Update the default locale

To update an agent's default locale,

  1. Open the Business Communications Developer Console and sign in with your Business Messages Google account.
  2. Choose your agent.
  3. In the left navigation, click Agent information.
  4. For Locale, choose the two-character ISO 639-1 language code that corresponds to the new default locale.
  5. If necessary, update the agent's conversational settings to match the new locale.
  6. Click Save.