For the complete documentation index, see llms.txt. This page is also available as Markdown.

Translate content with conditions

Use language conditions and dynamic blocks to show translated content based on your store's Shopify Markets and Languages configuration.

Use dynamic blocks with language conditions to display content in your customers' language. You enter each translation yourself, and Hubble shows the content from the setting whose condition matches.

This guide uses an Announcement Banner with English as the fallback language and a French translation. You can follow the same steps for other dynamic block types and languages.

Before you begin

Language conditions are driven by Shopify's native Markets and Languages configuration. Make sure the languages you want to use are published and assigned to the relevant markets in Shopify.

For setup details, see Shopify's guide to managing languages and making them available to markets.

Set up translated content

1

Create a language condition

In Hubble, go to Conditions and click Create new condition.

  • Give it a descriptive name, such as French language.

  • Add the Market condition type.

  • Add a rule: Language is equal to French.

  • Click Save.

Repeat for each language that needs its own translation. You can reuse these conditions across multiple dynamic blocks.

For the full walkthrough, see Create a condition.

2

Create a dynamic block and default content

Go to Blocks > Dynamic Blocks, click Create new block, and select Announcement Banner.

Give the block a descriptive name, such as Translated welcome message. Add a Default setting with your fallback content. For this example, use the English heading Welcome back!

The Default setting appears when no setting with conditions matches. It does not need a language condition.

For the block creation steps, see Dynamic blocks.

3

Add a translated setting

Click Create a Setting with conditions.

  • Setting name: Enter a name such as French welcome message.

  • Settings: Enter the French content, such as Bon retour ! for the heading. Translate any other customer-facing text you use in the block.

  • Conditions: Select the French language condition you created earlier.

Click Save, then return to the dynamic block's page.

Repeat this step for each additional translation, assigning its corresponding language condition. For more detail, see Assign a condition to content.

Hubble does not translate your content automatically. Each setting contains the translation you provide, and its condition determines when that version appears.

4

Review the priority and publish

Review your translated settings in the block's priority table. If more than one setting matches, the highest-priority matching setting is displayed. If none matches, the Default setting is displayed.

Click Publish and follow the steps to add the block to your customer account pages.

5

Test as a customer

Log in to your store as a customer and open the page where you published the block.

Switch markets using the options available in your store, based on your Shopify Markets and Languages configuration. For each language you configured, check that the corresponding translated content appears.

For this example:

  • When the customer's language is French, the banner shows Bon retour !.

  • When no translated setting matches, the banner shows the default Welcome back!.

If the wrong version appears, check that the language is published and available to the selected market, the setting has the correct language condition, and no higher-priority matching setting takes precedence.

Last updated