ローカライズされたテキストを指定する
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。"],[[["Localizing Actions Center Local Services Ads is highly recommended to provide users with a tailored experience based on their language settings."],["Localization can be achieved by providing translated text for various fields, such as service names and descriptions, as detailed in the feed specification."],["The `Text` message structure allows for specifying a default value and localized values for supported languages, ensuring content is displayed appropriately."],["When a user's locale is not supported, either the default value or the first provided localized value will be displayed as a fallback."],["Even without full localization support, setting a default value and a single localized value for the supported language is advised for consistency."]]],["Localization is strongly encouraged within the Actions Center Local Services Ads integration. Fields using the `Text` message can be localized by providing a `localized_value` for each supported language and a default `value`. The user's language settings determine which `localized_value` is shown. If no locale match exists, the `value` acts as the default; or the first value in localized_value will be used. If localization is not supported, a single `localized_value` and `value` should be provided.\n"]]