Skip to main content
GET
/
store
/
locales
JS SDK
import Medusa from "@medusajs/js-sdk"

let MEDUSA_BACKEND_URL = "http://localhost:9000"

if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
  MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}

export const sdk = new Medusa({
  baseUrl: MEDUSA_BACKEND_URL,
  debug: process.env.NODE_ENV === "development",
  publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})

sdk.store.locale.list()
.then(({ locales }) => {
  console.log(locales)
})
{
  "locales": [
    {
      "code": "en-US",
      "name": "English (United States)"
    }
  ]
}

Headers

x-publishable-api-key
string
required

Publishable API Key created in the Medusa Admin.

x-medusa-locale
string

The locale in BCP 47 format to retrieve localized content.

Example:

"en-US"

Query Parameters

locale
string

The locale in BCP 47 format to retrieve localized content.

Example:

"en-US"

Response

OK

The list of supported locales in the store.

locales
object[]
required

The list of supported locales in the store.