指定本地化文字
强烈建议在 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 Reservations Waitlists integration to provide users with a personalized experience in their preferred language."],["Localizable fields, such as service names and descriptions, can be customized using the `Text` message format, specifying both a default `value` and `localized_value` for each supported language."],["When a user interacts with the integration, the system will display the `localized_value` corresponding to their browser's language settings, falling back to the default `value` if their locale is not supported."],["If localization is not implemented, it is crucial to provide both `value` and `localized_value` with the supported language and locale to ensure proper functionality and user experience."]]],["Localization is recommended for the Actions Center Reservations Waitlists integration, enabling a tailored user experience based on language settings. Utilize the `Text` message in feeds to provide `localized_value` for each supported language, alongside a default `value`. The system will prioritize `localized_value` according to the user's locale; otherwise, it falls back to `value`, or the first `localized_value` if the default is missing. If localization is unsupported, a single language in `localized_value` with a default `value` should be provided.\n"]]