Storefront Language Selector
A language selector enables shoppers to switch between the storefront languages you have configured. Stencil automatically provides the necessary data through the language_selector object; your theme is responsible for rendering the UI and wiring up interactivity.
language_selector object
Stencil exposes a language_selector object on every page. It contains the following properties:
Implementation
The language selector is already built into Cornerstone 6.19.0 and later. If your theme includes this feature, no additional implementation is needed — the steps below apply to third-party themes or custom themes based on earlier Cornerstone versions.
Create a Handlebars partial
Create a new partial file, for example templates/components/common/language-selector.html. Use data-locale-code attributes so JavaScript can resolve human-readable language names.
This markup is a simplified reference, not a copy of Cornerstone’s production dropdown. Cornerstone’s own language-selector.html toggles visibility with Foundation’s data-dropdown behavior, which only works in themes that bundle Foundation. Stencil has no shared dropdown primitive, so toggle behavior is theme-specific — several partner themes use a native <select> element instead, since keyboard navigation and accessibility come for free from the browser. If you build a custom dropdown like the one below, you’re responsible for wiring up the JavaScript that opens and closes it (toggling aria-expanded and showing or hiding the list).
Include the partial in your header template, gating the include with {{#and}} so the selector only renders when the store has more than one active language:
Cornerstone also ships a separate mobile partial at templates/components/common/language-selector-mobile.html, included from navigation-menu.html. If your theme has a distinct mobile navigation, create an equivalent mobile partial and gate its include the same way.
Resolve locale codes to display names
The code values returned by Stencil (such as es or fr-CA) are machine-readable locale identifiers. Use the browser’s Intl.DisplayNames API to display native language names instead.
Import and call initLanguageSelector() from your global theme entry point.