指定本地化文字
强烈建议在 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 in Actions Center Reservations is highly recommended to provide users with a tailored experience based on their language settings."],["Localizable fields, such as service names and descriptions, can be found in the feed specification, and are identified by utilizing the `Text` message type."],["Implementing localization involves providing both a default `value` and `localized_value` entries within the `Text` message, enabling the system to display the appropriate text based on the user's locale."],["If localization is not supported, it's crucial to specify the `localized_value` and `locale` with the supported language, while also setting the default `value` for fallback purposes."]]],["Localization is strongly recommended in the Actions Center Reservations integration. Fields using the `Text` message can be localized by specifying a `localized_value` for each supported language and a default `value`. The user's locale, from their browser settings, determines which `localized_value` is displayed. If the user's locale isn't found, the provided `value` is the default. If `value` is not set, the first value from `localized_value` is used. Even for single-language support, set both `value` and `localized_value`.\n"]]