Liquid Snippets by ALSEL
📘 公式リファレンス📦 リファレンス/オブジェクト中級

localization オブジェクト

ストアで利用可能な国・言語、および現在選択されている市場・国・言語の情報を取得するオブジェクト。Shopify Markets や多言語対応を実装する際に使用する。

用途
ストアの言語切り替えフォームやローカライゼーションセクションで、利用可能な言語・国の一覧を動的に表示したり、ユーザーが現在選択している市場や言語を判定したいとき。
設置場所
Liquid テンプレート内で `{{ localization.available_countries }}`、`{{ localization.available_languages }}`、`{{ localization.market }}`、`{{ localization.country }}`、`{{ localization.language }}` の形でプロパティを参照する。通常は localization form タグ内または言語切り替えセクションで使用する。
注意点
localization オブジェクトは Shopify Markets が有効化されている場合に機能する。available_countries、available_languages はそれぞれ country、shop_locale オブジェクトの配列を返すため、ループで各国・言語の詳細情報(名前、コードなど)にアクセスする必要がある。市場未設定のストアでは market、country の値が空になる可能性があるため、テンプレートで `if localization.market` で存在チェックを行う。
タグ:localizationmarketmulti-languagecountryi18n

仕様

101 行 / json
{
  "access": {
    "global": true,
    "parents": [],
    "template": []
  },
  "deprecated": false,
  "deprecation_reason": "",
  "description": "The `localization` object can be used in a [localization form](/docs/api/liquid/tags/form#form-localization).\n\nTo learn about how to offer localization options in your theme, refer to [Support multiple currencies and languages](/themes/internationalization/multiple-currencies-languages).",
  "properties": [
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "array",
          "name": "",
          "description": "",
          "array_value": "country"
        }
      ],
      "summary": "The countries that are available on the store.",
      "name": "available_countries"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "array",
          "name": "",
          "description": "",
          "array_value": "shop_locale"
        }
      ],
      "summary": "The languages that are available on the store.",
      "name": "available_languages"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "market",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The currently selected market on the storefront.",
      "name": "market"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "country",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The currently selected country on the storefront.",
      "name": "country"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "shop_locale",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The currently selected language on the storefront.",
      "name": "language"
    }
  ],
  "summary": "Information about the countries and languages that are available on a store.",
  "name": "localization",
  "examples": [],
  "json_data": {
    "path": "/",
    "handle": "localization",
    "data_from_file": ""
  },
  "return_type": []
}

出典・ライセンス

License:
MIT

このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。

関連項目

📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_header オブジェクト

Shopify が必要とするスクリプト(分析・チェックアウト・言語設定など)をすべて動的に出力するオブジェクト。theme.liquid の <head> タグ内に埋め込む必須要素。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト中級

metaobjects オブジェクト

ストア全体のメタオブジェクト定義にアクセスするグローバルオブジェクト。個別のメタオブジェクトはタイプとハンドルで参照でき、メタオブジェクト定義のエントリをループで反復処理できる。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト初級

additional_checkout_buttons オブジェクト

PayPal Express Checkout など、オフサイト決済に対応した外部決済プロバイダーがストアに設定されているかを真偽値で返す。`content_for_additional_checkout_buttons` と組み合わせて、該当するチェックアウトボタンを条件付きで表示する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

canonical_url オブジェクト

現在のページの正規 URL を取得するオブジェクト。Google などの検索エンジンに対してどのページ版が正規であるかを指定するために使用する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_index オブジェクト

ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_additional_checkout_buttons オブジェクト

PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。

📁 theme-liquid-docs·MIT·27