指定本地化文字
强烈建议在 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 Redirect integration to provide users with a tailored experience in their preferred language."],["Developers can localize many fields, including service names and descriptions, by using the `Text` message and providing localized values for supported languages."],["It's crucial to specify both a default `value` and `localized_value` within the `Text` message for each localizable field."],["If localization isn't supported, set `localized_value` and `locale` with the single supported language and provide a default `value`."]]],["Localization is strongly recommended for the Actions Center Appointments Redirect integration, using the `Text` message to localize fields like service names. Provide a default `value` and a `localized_value` array for each supported language. The `localized_value` is displayed based on the user's browser language settings; otherwise, the `value` is shown as a default. If localization isn't supported, provide one `localized_value` and set `locale` with the single language you support, setting a default `value` as well.\n"]]