> ## Documentation Index
> Fetch the complete documentation index at: https://docs-test.rye.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Localization

> 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`](/docs/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`](/docs/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)

<CodeGroup>
  ```GraphQL Request theme={null}
  query ShopifyCollection {
    shopifyCollection(id: "SOME_COLLECTION_ID") {
      id
      title
      description
      productsConnection(first: 50) {
        edges {
          node {
            id
            title
            price {
              displayValue
              value
              currency
            }
          }
        }
      }
    }
  }
  ```

  ```JSON Example response theme={null}
  {
      "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"
                              }
                          }
                      }
                  ]
              }
          }
      }
  }
  ```
</CodeGroup>

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

<CodeGroup>
  ```GraphQL Request theme={null}
  query ShopifyCollection @inContext(country: CA) {
    shopifyCollection(id: "SOME_COLLECTION_ID") {
      id
      title
      description
      productsConnection(first: 50) {
        edges {
          node {
            id
            title
            price {
              displayValue
              value
              currency
            }
          }
        }
      }
    }
  }
  ```

  ```JSON Example response theme={null}
  {
      "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"
                              }
                          }
                      }
                  ]
              }
          }
      }
  }
  ```
</CodeGroup>

## Supported operations

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