Language support in themes: translate theme texts with t-tags
How to mark texts in your Shoporama theme with t-tags, so they can be edited in the admin and translated into the language of each of the store's countries.
Shoporama has a built-in translation feature for themes. You mark text with Smarty <{t}> tags, and the text can then be edited in the admin and translated into the language of each of the store's countries.
How to mark text for translation
Wrap text that needs translating in <{t}> tags, or use |t when the text is a value:
<{t}>Add to cart<{/t}>
<{t}>See more<{/t}>
<{t}>Price<{/t}>
<{include file="components/alert.html" text="Your profile has been updated."|t}>
If a value needs to appear in the text, pass it as a parameter and use it as {x}. If a variable is placed directly inside the text, every value becomes a separate text that has to be translated on its own:
<{if $customer}>
<{t x=$customer->getActivePoints()}>You have {x} active points.<{/t}>
<{/if}>

The text between the tags is the key. If you change the text in the theme, even a space or a line break inside the text, it becomes a new text that has to be edited and translated again. Also remember the email templates, attributes such as placeholder and title, and messages in the checkout.
Edit the theme's texts
You edit the store's own texts in the store's language under Design → Texts:
- Go to Design → Texts in your admin
- All texts marked with <{t}> tags are listed here, with the theme's original on the left
- Enter your own text in the Translation field
- Click Save translations
More languages with Countries
You choose the store's own language under Webshop → General in the Language field (Danish, English, German, Swedish, Norwegian, or Dutch). Among other things, it determines the date format, month names, and default texts.
If you want to sell in several languages, you add countries under Webshop → Countries. Each country gets its own language (one of 22 European languages), its own currency, and its own address, such as yourstore.dk/se or yourstore.se. The theme's texts are then translated into each language under Webshop → Translations → Theme texts:
- With automatic translation (turned on by default), new and changed texts are translated within a few minutes.
- Anything you or the store owner edits manually is never overwritten by the automatic translation.
- Shoporama reads through the theme's files, so the texts can be translated before a customer has seen them.
- If a translation is missing, the store's own text is shown.
How to set up the countries is described in Sell in multiple countries with Countries, and how to translate the texts in Translate your online store.
Product translations
Products, categories, pages, menus, and other content are translated under Webshop → Translations or via the Translations link at the top of, for example, the product page. You don't need to change the theme to show them: $product->getName(), $product->getUrl(), and the other methods return the country's text and address. Shoporama also adds hreflang tags for the countries automatically. See Hreflang and alternate tags for multilingual online stores.
Get the theme ready for countries
If you have your own theme, there are a few more things the theme needs to handle before the store can sell in other countries:
- Add "countries": true to the theme's theme_settings.json when the theme is ready, and "text_language" if the texts in <{t}> are not written in Danish (for example "en").
- Show the currency with $webshop->getCurrency() and amounts from orders with $order->getCurrency(), not "kr." (Danish kroner) written directly in the template.
- Format numbers with the country's separators: |number_format:2:$webshop->getDecimalSeparator():$webshop->getThousandSeparator().
- Add a language switcher with $webshop->getCountrySites().
- Show the delivery countries with $webshop->getDeliveryCountries(), and show a message when $get.delivery_country is set.
All the steps with code examples and a checklist are in Get your theme ready for multiple languages and countries. Shoporama's own themes, such as Montana and Delaware, are already ready.
Tip
Use <{t}> tags consistently in your theme. Text without tags cannot be edited in the admin or translated, and it is shown in the same language in every country.
Frequently asked questions
What is the difference between Design → Texts and Webshop → Translations?
Under Design → Texts, you edit the theme's texts in the store's own language. Under Webshop → Translations, you translate them into the language of each country. The translations are based on the store's own texts.
Can I include translations with the theme?
For the store's own language, the theme can include a langs/ folder that fills in Design → Texts when the theme is activated. The countries' languages are translated under Webshop → Translations, automatically, manually, or with a CSV file.
Why is a text still in Danish in one of the countries?
Usually because it is not wrapped in <{t}>, has a variable inside the text, or has not been translated yet. You can fix it yourself under Webshop → Translations → Theme texts.
Need help? Contact us at support@shoporama.dk.
Related articles
Fetch content from an external URL in themes
How to fetch content from external URLs into Shoporama themes with the fetch_file function in Smarty 2 or Smarty's built-in fetch function in...
Shoporama themes: an overview of all free store themes
A complete overview of all free themes in Shoporama: Delaware, DelawareDK, California, Alaska 2, Washington, Montana, and the classic Smarty 2...
Customize the content of your automatic emails
How to customize the automatic emails your Shoporama store sends: without code under Design > Emails, with subject lines and texts in the store...
Make your theme ready for multiple languages and countries
Step by step for developers: how to make a custom Shoporama theme work with Countries, with translated texts, the country's currency and number...
Hreflang and multilingual stores in Shoporama
How Shoporama sets hreflang, x-default, and html lang for your countries, what happens to untranslated pages, and how to handle your own hreflang...
Translate your online store into other languages
How to translate your store when you sell in several countries: automatic translation, status per language, editing translations, translated URLs,...
Sell in multiple countries, languages, and currencies
Sell in other countries in your customers' own language and currency with Countries: add a country, set up its address, language, currency, and...