Adding Localization to Your Storefront (Beta)
For a full overview of localization in Pack Admin and the Customizer, see Localization guide.
GraphQL Queries
- Queries now accept two optional parameters—
language
andcountry
—which will return translated content when available, or default to your primary locale. - You must also use the
@inContext
directive. For example, fetching a page by handle becomes:
query PageByHandle(
$handle: String!
$language: String
$country: String
) @inContext(language: $language, country: $country) {
pageByHandle(handle: $handle) {
id
handle
}
}
- To request the French-Canadian version of “About Us,” pass these variables:
{
"handle": "about-us",
"language": "fr",
"country": "CA"
}