Skip to main content

Translations

The Translations page manages every user-facing string emitted by Haus Storefront widgets. Defaults are seeded from the plugin's English source, additional languages can be added on top, and saved translations are published as JSON files that the storefront loads at runtime through i18next.

Go to WordPress Admin > Haus Storefront > Translations.

What You Can Do

  • Add and remove supported storefront languages.
  • Edit translated values per key for each language.
  • Search across keys, namespaces, and existing values.
  • Insert dynamic placeholders such as {{productName}} where the source string supports them.
  • Publish new translation JSON files and bump the storefront i18n version on save.

UI Workflow

  1. Open Manage available languages and add the language codes you need.
  2. Use the search box to locate a key by namespace, key path, or any existing value.
  3. Enter or paste a translation in the per-language column. Empty cells use the English default.
  4. For dynamic strings, use the placeholder picker to insert tokens such as {{productName}}.
  5. Click Save — the plugin validates entries, persists the option, regenerates the published JSON files, and bumps the i18n version.

Locale Resolution

Widgets resolve the active language as follows:

  1. Use the explicit locale prop passed to the widget if non-empty.
  2. Otherwise, read document.documentElement.lang and take the first segment (e.g. sv-SE -> sv).
  3. Fall back to en.

Set <html lang="..."> correctly on the page (typically via your WordPress translation plugin or theme) to drive widget locale.

Published Files

Saving regenerates files under wp-content/uploads/haus-i18n/:

  • haus-i18n/{lang}/{namespace}.json — per-namespace JSON.
  • haus-i18n/{lang}/translation.json — merged file consumed by the runtime loadPath.

Cache-bust by checking the ?v= parameter on the storefront's load URL after saving.

Reverting Translations (CLI)

To wipe translation state and let migrations re-run from scratch on the next admin load:

wp haus-storefront revert-translations