Set the default locale
[Internationalization] helps merchants expand their business to a global audience by creating shopping experiences in local languages and currencies. This guide provides information on configuring your storefront's default language and country and how to retrieve translated content from the Storefront API.
Set a default language and country
Anchor link to section titled "Set a default language and country"Set Hydrogen storefront's default language and country by setting the defaultLanguageCode
and defaultCountryCode
properties in the Hydrogen configuration file.
Override the default locale at runtime
Anchor link to section titled "Override the default locale at runtime"You can change the active country and language at runtime by passing overrides from the countryCode
and languageCode
props to the ShopifyProvider
component.
Retrieve translated content from the Storefront API
Anchor link to section titled "Retrieve translated content from the Storefront API"You can use the useLocalization
hook to pass the visitor's active country
and language
into your Storefront API query. For example, you might need to create a product page in a customer's language:
For more information about retrieving language translations and the @inContext
directive, refer to the Storefront API documentation.
- Learn how to internationalize routes.
- Learn how to configure other localized experiences for merchants and customers using the GraphQL Storefront API.