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

shop_locale オブジェクト

ストアで利用可能な言語ロケールを表現するオブジェクト。言語名、ISO コード、ルート URL などのロケール情報にアクセスできる。

用途
多言語対応ストアで、現在のロケール情報を取得したり、利用可能な言語リストを言語名とともに表示するとき。言語切替メニューやロケール判定に用いる。
設置場所
Liquid テンプレート内で `{{ shop.published_locales[0].name }}` や `{{ request.locale.iso_code }}` のようにプロパティを参照する。localization オブジェクトの available_languages や language プロパティからもアクセスできる。
注意点
shop_locale はグローバルスコープでは直接参照できず、shop.published_locales、localization.available_languages、request.locale 経由でのみ取得される。primary プロパティでプライマリロケールを判定するとき、複数言語が同時に primary: true になることはないため安全に判定できる。root_url は Shopify Markets の設定に基づくため、マーケット設定前は空またはストア URL のベースとなる。
タグ:localizationlanguagelocaleinternationalizationmultilingual

仕様

122 行 / json
{
  "access": {
    "global": false,
    "parents": [
      {
        "object": "localization",
        "property": "available_languages"
      },
      {
        "object": "localization",
        "property": "language"
      },
      {
        "object": "request",
        "property": "locale"
      },
      {
        "object": "shop",
        "property": "published_locales"
      },
      {
        "object": "shop",
        "property": "locale"
      }
    ],
    "template": []
  },
  "deprecated": false,
  "deprecation_reason": "",
  "description": "To learn 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": "string",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The name of the locale in the store's primary locale.",
      "name": "name"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "string",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The name of the locale in the locale itself.",
      "name": "endonym_name"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "string",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The ISO code of the locale in [IETF language tag format](https://en.wikipedia.org/wiki/IETF_language_tag).",
      "name": "iso_code"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "boolean",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "Returns `true` if the locale is the store's primary locale. Returns `false` if not.",
      "name": "primary"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "string",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The relative root URL of the locale.",
      "name": "root_url"
    }
  ],
  "summary": "A language in a store.",
  "name": "shop_locale",
  "examples": [],
  "json_data": {
    "path": "/",
    "handle": "shop.published_locales[0]",
    "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