指定本地化文字
强烈建议在 Actions Center Retail Ordering Business Link 集成中支持本地化。系统会根据用户的语言设置,向用户显示本地化体验。如果未设置任何本地化设置,系统可能会向用户显示默认文本。您可以为集成中的许多字段(例如服务名称和说明)提供本地化文本。如需查看可使用 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 Retail Ordering Business Link integration to provide users with a personalized experience in their preferred language."],["You can localize many fields like service names and descriptions using the `Text` message format specified in the feed specification."],["Both `value` (default text) and `localized_value` (language-specific text) are required for localization to function correctly, ensuring content is displayed even if a user's locale isn't explicitly supported."],["If localization isn't supported by your system, provide a single `localized_value` with your supported language and locale, along with a default `value`."]]],["Localization is strongly recommended for the Actions Center Retail Ordering Business Link integration. You can localize fields like service names and descriptions by using the `Text` message within the feed. Each localized field requires a default `value` and `localized_value` entries for each supported language. The `localized_value` is displayed based on the user's language settings, and the `value` is used as a default. If localization is not supported, set the `localized_value` with your single supported language and set the default `value`.\n"]]