ローカライズされたテキストを指定する
Actions Center 予約のエンドツーエンド統合でローカライズをサポートすることを強くおすすめします。ユーザーには、言語設定に基づいてローカライズされたエクスペリエンスが表示されます。ローカライズが設定されていない場合、デフォルトのテキストがユーザーに表示されることがあります。統合の多くのフィールド(サービス名や説明など)にローカライズされたテキストを指定できます。Text
メッセージを使用してローカライズできるフィールドの一覧については、フィード仕様をご覧ください。
ローカライズの実装
// 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;
}
Text
メッセージを使用しているフィードのフィールドは、サポートされている言語ごとに localized_value
を指定してローカライズできます。
value
と localized_value
の両方を指定する必要があります。
localized_value
は、ユーザーのロケール(ユーザーの言語ブラウザ設定で設定)に基づいて表示されます。
- ユーザーのロケールがサポートされているローカライズのリストにない場合、この値がデフォルトとして使用されます。
- 値を定義しておらず、ユーザーのロケールがサポートされているローカライズのリストにない場合は、localized_value に存在する最初の値が使用されます。このフォールバックは使用できますが、デフォルト値を明示的に指定することを強くおすすめします。
システムでローカライズをサポートしていない場合は、localized_value
を設定し、サポートする言語のみを locale
に設定してください。デフォルトとして使用できる value
も設定します。
サービス フィードのスニペットの例
"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 Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-11-26 UTC。
[null,null,["最終更新日 2024-11-26 UTC。"],[[["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"]]