Skip to main content

Storefront locales

This kit installs seven storefront locales. The admin shows or hides them. Adding another locale is a code change, then a deploy.

Two layers:

LayerWhere it is setWhat it controls
Installedlocales in src/config/site.config.tsLocales the build can route. The Storefront Languages checklist only lists these.
EnabledSystem → Storefront Languages (site.locales.enabled)Language switcher, public URLs, sitemap, hreflang, and language tabs on catalog and blog forms.

English is the default locale and stays enabled. Until you save a custom list, the public set is en, hk, jp, and kr. German, French, and Spanish are installed and disabled until you enable them.

Chrome strings (navigation, buttons, checkout labels) live in src/i18n/locales/frontend/. The admin screen does not edit them. Product, category, and blog copy are the JSON fields you import or edit in the admin. The sample catalog already includes those fields for the seven content languages below.

Installed locales​

The URL prefix is the path segment. The content language is the JSON key, the blog language, and the hreflang value. Three legacy prefixes differ from that code. New locales use the same token for both.

URL prefixContent languagePublic by default
enenYes. Always enabled.
hkzh-TWYes
jpjaYes
krkoYes
dedeNo
frfrNo
esesNo

A first visit with no locale cookie redirects to an enabled locale that matches Accept-Language. A public URL for an installed locale that is currently disabled returns 308 to the same path under en. Admin URLs stay reachable on every installed locale, including one that is hidden from the storefront, so you can turn it back on.

SEO​

Canonical, hreflang, and sitemap URLs use the Site URL from System → Site Settings. Set that value before you rely on search tags.

Only enabled locales are listed. Each alternate uses the content language in hreflang and the URL prefix in the path. x-default points at en.

URL prefixhreflangExample path
hkzh-TW/hk/product/example
jpja/jp/product/example
krko/kr/product/example
dede/de/product/example

de, fr, and es appear in that set after you enable them.

Add a locale​

  1. Add the locale to LOCALE_DEFINITIONS in src/i18n/localeRegistry.ts. The URL prefix and the content language are the same token.
  2. Append that prefix to locales in src/config/site.config.ts.
  3. Add shop/<lang>.json and bill/<lang>.json under src/i18n/locales/frontend/default/. The filename is the content language (zh-TW.json, not the URL prefix). Register both packs in src/i18n/frontendMessageCatalog.ts.
  4. Add the content language to amplify/functions/shared/contentLanguages.ts.
  5. Deploy, then enable the locale under System → Storefront Languages.

Catalog JSON for the new language can ship in an import pack or be entered on the product and blog forms after the locale is enabled.

Next step​

The store runs from the admin without further code. Development path grades a later change to the source, when you choose to make one.