指定本地化文字
强烈建议在 Action Center 预约端到端集成中支持本地化。系统会根据用户的语言设置,向用户显示本地化体验。如果未设置任何本地化设置,系统可能会向用户显示默认文本。您可以为集成中的许多字段(例如服务名称和说明)提供本地化文本。如需查看可使用 Text
消息本地化的字段的完整列表,请参阅我们的 Feed 规范。
实现本地化
// A possibly-localized text payload. Some Text fields may contain marked-up
// content.
message Text {
// Required. Text value in an unknown locale, which will be displayed if
// `localized_value` for the user locale is empty or missing. The locale for
// this value may depend on the partner or service provider, and it should not
// be assumed to be any specific language.
string value = 1;
// Per-locale text values. Required.
repeated LocalizedString localized_value = 2;
}
通过为每种支持的语言提供 localized_value
,您可以本地化 Feed 中使用 Text
消息的任何字段。
必须同时指定 value
和 localized_value
。
- 我们会根据用户的语言区域(在用户的浏览器语言设置中设置)显示
localized_value
。
- 如果用户的语言区域不在支持的本地化列表中,系统会将此值用作默认值
- 如果您未定义 value,并且用户的语言区域不在支持的本地化列表中,我们将使用 localized_value 中第一个值。虽然可以使用此回退,但我们强烈建议您明确指定默认值。
如果您的系统不支持本地化,请设置 localized_value
,并使用您支持的唯一语言设置 locale
。还要设置 value
,它可以用作默认值。
服务 Feed 代码段示例
"localized_service_name": {
"value": "Chocolate Tasting",
"localized_value": [
{
"locale": "en",
"value": "Chocolate Tasting"
},
{
"locale": "fr",
"value": "Dégustation de chocolats"
}
]
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-11-26。
[null,null,["最后更新时间 (UTC):2024-11-26。"],[[["Localization is highly recommended for the Actions Center Appointments End-to-End integration to provide users with a personalized experience based on their language settings."],["You can provide localized text for various fields like service names and descriptions using the `Text` message format, ensuring both a default `value` and locale-specific `localized_value` are provided."],["If localization is not supported, set `localized_value` and `locale` with your supported language and `value` as a default, promoting a consistent user experience."],["The system prioritizes displaying the `localized_value` based on the user's browser language settings, using the default `value` if the locale isn't supported or if `localized_value` is missing for the given locale."]]],["Localization is recommended in the Actions Center Appointments integration, allowing users to see content in their preferred language. Fields using the `Text` message can be localized by providing a `localized_value` for each supported language. Both `value` (default text) and `localized_value` (locale-specific text) are required. The `localized_value` displays based on the user's locale; `value` acts as a fallback. If localization is unsupported, a single language can be set for both `localized_value` and `value`.\n"]]