Locales Configuration
This overview explains how to manage locales using the GraphQL Admin API.
Introduction
The BigCommerce GraphQL Admin API enables developers to manage languages across different channels. By accessing locale data and related configurations, developers can more easily localize headless storefronts.
Locale management is available on Catalyst storefronts.
Getting started
With the GraphQL Admin API, merchants can add, update, or remove locales for each sales channel, change locale status, and set a locale as the default. Below are examples of GraphQL queries and mutations for retrieving and managing locale settings.
Example requests
This section provides examples of GraphQL Admin API queries and mutations that demonstrate how to manage locales, along with the required HTTP configuration.
POST https://api.bigcommerce.com/accounts/{{store_hash}}/graphql
X-Auth-Token: {{access_token}}
Accept: application/json
Content-Type: application/json
Query locales supported by the platform
This query returns a static list of all locales currently supported by the platform.
query {
i18n {
supportedLocales {
code
englishName
hasBuiltInTranslations
}
}
}
Query channel locales
The following query returns channel locales.
query {
store {
locales(input: { channelId: "bc/store/channel/1"}) {
edges {
node {
code
status
isDefault
}
}
}
}
}
Add a locale
The following mutation adds a locale.
mutation {
locale {
addLocale(input: {
channelId: "bc/store/channel/1",
code: "fr",
status: INACTIVE
}) {
locale {
code
status
}
errors {
... on Error {
message
}
}
}
}
}
Update a locale
The following mutation updates a channel's locale.
mutation {
locale {
updateLocale(input: {
channelId: "bc/store/channel/1",
code: "fr",
status: ACTIVE,
isDefault: false
}) {
locale {
code
status
isDefault
}
errors {
... on Error {
message
}
}
}
}
}
Delete a locale
The following mutation deletes a channel's locale.
mutation {
locale {
deleteLocale(input: {
channelId: "bc/store/channel/1",
code: "fr",
}) {
code
errors {
... on Error {
message
}
}
}
}
}