Skip to main content
A localized Next.js storefront declares its markets once and derives everything else from that list: the URL prefixes, the market each request reads in, what Studio’s market selector shows, and which theme copy Studio’s Translation Manager translates. For how Weaverse and Shopify Markets fit together in general, see Markets and Localization. This page covers the Next.js wiring.

One locale list

Keep a single table of the markets you sell in. Every other piece reads from it.

Three identities, never interchanged

A market has three identities. Mixing them up is the most common localization bug. Map Weaverse’s language + country back to your URL id when you need it. Don’t parse i18n.locale for routing.

Declare markets in the theme schema

The theme schema’s i18n is what Studio’s market selector and Translation Manager read. Derive it from the locale list:
  • urlStructure: 'url-path' tells Studio markets are distinguished by a path prefix.
  • translation: true turns on the Translation Manager for this theme.
  • staticContent is the theme’s own copy in the default language (see Theme copy).

Route every market

Put rendered routes under a [locale] segment, and keep the default market unprefixed with a proxy (middleware.ts before Next.js 16):
Route handlers, robots and sitemap stay outside the [locale] segment.
During server rendering, Next.js reports the rewrite target (/en-us/...) as the path. Build links and Weaverse pathnames from the locale-free path plus the market’s prefix, not from the rewritten path.

Read each request in its market

Give the server client the request’s market in requestContext.i18n:
  • Pass the locale-free pathname. The SDK prepends i18n.pathPrefix, so Studio sees the same URL as the browser (/de-de/products/...).
  • language and country select the page Weaverse returns for that market, and they are what component loaders read to query Shopify in the same market. See Data Fetching.
  • The bridge reads i18n.language; always set i18n, even for a single-market store.
Format prices with the currency the Storefront API returns, never one derived from the locale.

Translate theme copy

Theme copy is the text your theme renders that merchants don’t author: button labels, empty states, cart messages. Keep it in one object in the default language and register it as staticContent:
Merchants translate it per market in Studio’s Translation Manager. Section settings and Shopify content are not theme copy; Weaverse and Shopify localize those themselves.

Load the market’s overrides

loadThemeSettings() fetches the active market’s translated copy as merchantOverrides when the theme schema declares i18n and the request context has both language and country. A failed overrides fetch never fails theme settings. Load it once in the [locale] layout and pass it to the root provider. Extend the client WeaverseRoot wrapper from the Quickstart with the translation props:
staticContent falls back to themeSchema.i18n.staticContent when omitted.

Use t() in components

useTranslation() returns a t() that resolves a key through every source, highest priority first:
  1. An external t passed to WeaverseNextRootProvider (your own i18n library), unless it returns the key unchanged
  2. Live edits from Studio’s Translation Manager (design mode)
  3. merchantOverrides for the active market
  4. staticContent
  5. The key itself
useTranslation() must run under WeaverseNextRootProvider (or a TranslationProvider). It also exposes merchantOverrides and translationStore if you build your own translator. Outside React, for example in generateMetadata, build the same function with createTranslate:
Server Components can’t call hooks. Render theme copy from a small client leaf that calls useTranslation(), so Studio’s live translation edits still reach text a Server Component owns.

In Studio

  • The market selector lists every entry of i18n.shopLocales. Picking a market loads the preview under its pathPrefix, and merchants can author a localized page per market.
  • The Translation Manager lists your staticContent keys. Edits show live in the preview and are saved as that market’s merchantOverrides.
See the Translation Feature Guide for the merchant workflow.

Next steps

Rendering Pages

Load and render Weaverse pages in App Router routes.

Connect Weaverse Studio

The bridge, route identity and revalidation.

Data Fetching

Read Shopify in the request’s market from component loaders.

API Reference

Translation exports and types.