> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: 'Localization'
description: 'Some Sync API endpoints support localization for price value and currency. This guide will help you learn how to use localization in the Rye API.'
---

## Introduction

For Shopify stores that have the Rye Shopify app installed, some Rye API operations support localization for price value and currency. This means that you can use the Rye API to get the price value and currency in the language and currency that the customer prefers. To enable localization, you should use the [`@inContext`](/api-reference/directives#incontext) GraphQL directive that includes information about the preferred country. Note that the Shopify store must have [local currencies enabled](https://help.shopify.com/en/manual/markets/pricing/set-up-local-currencies) for this feature to work within Rye.

## GraphQL Directive

For localization, the Rye API expects the use of the [`@inContext`](/api-reference/directives#incontext) directive in your GraphQL queries or mutations. This directive takes a country as an argument and converts prices within the query/mutation responses into the specified country’s currency.

### Example request and response without localization (default USD)

<Tabs items={["Request", "Example response"]}>
  <Tab title="Request">
    ```GraphQL
    query ShopifyCollection {
      shopifyCollection(id: "SOME_COLLECTION_ID") {
        id
        title
        description
        productsConnection(first: 50) {
          edges {
            node {
              id
              title
              price {
                displayValue
                value
                currency
              }
            }
          }
        }
      }
    }
    ```
  </Tab>

  <Tab title="Example response">
    ```JSON
    {
        "data": {
            "shopifyCollection": {
                "id": "SOME_COLLECTION_ID",
                "title": "Collection title",
                "description": "Collection description",
                "productsConnection": {
                    "edges": [
                        {
                            "node": {
                                "id": "SOME_PRODUCT_ID",
                                "title": "Product title",
                                "price": {
                                    "displayValue": "$9.95",
                                    "value": 995,
                                    "currency": "USD"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
    ```
  </Tab>
</Tabs>

### Example request and response with localization (CAD)

<Tabs items={["Request", "Example response"]}>
  <Tab title="Request">
    ```GraphQL
    query ShopifyCollection @inContext(country: CA) {
      shopifyCollection(id: "SOME_COLLECTION_ID") {
        id
        title
        description
        productsConnection(first: 50) {
          edges {
            node {
              id
              title
              price {
                displayValue
                value
                currency
              }
            }
          }
        }
      }
    }
    ```
  </Tab>

  <Tab title="Example response">
    ```JSON
    {
        "data": {
            "shopifyCollection": {
                "id": "SOME_COLLECTION_ID",
                "title": "Collection title",
                "description": "Collection description",
                "productsConnection": {
                    "edges": [
                        {
                            "node": {
                                "id": "SOME_PRODUCT_ID",
                                "title": "Product title",
                                "price": {
                                    "displayValue": "CA$14.00",
                                    "value": 1400,
                                    "currency": "CAD"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
    ```
  </Tab>
</Tabs>

## Supported operations

* The [`integratedShopifyStore`](/api-reference/integratedShopifyStore) query
* The [`shopifyCollection`](/api-reference/shopifyCollectionQuery) query
* The [`productByID`](/api-reference/productbyid) query
* The [`productsByIds`](/api-reference/productsbyids) query


---

*Powered by [holocron.so](https://holocron.so)*
