PrestaShop provides a built-in system for translating theme wordings into any language.
In Smarty templates, use the {l} function with the d (domain) parameter. All wordings must be written in English:
{l s='Read more' d='Shop.Mytheme'}
Replace Mytheme with your theme’s name.
Shop.Mytheme is correct; Shop.MyTheme is not.Use the sprintf parameter to insert dynamic values:
{l
s='%count% items in your cart'
d='Shop.Mytheme'
sprintf=['%count%' => $cart.products_count]
}
{l
s='Welcome, %firstname% %lastname%!'
d='Shop.Mytheme'
sprintf=['%firstname%' => $customer.firstname, '%lastname%' => $customer.lastname]
}
{l
s='We noticed a problem with your order. If you think this is an error, feel free to contact our [1]expert customer support team[/1].'
d='Modules.Wirepayment.Shop'
sprintf=['[1]' => "<a class='alert-link' href='{$contact_url}'>", '[/1]' => '</a>']
}
PrestaShop uses dot-separated domains to organize translations:
| Domain | Purpose |
|---|---|
Shop.Mytheme |
Your theme’s custom wordings |
Shop.Theme.Global |
Shared theme wordings (core) |
Shop.Theme.Catalog |
Catalog-related wordings (core) |
Shop.Theme.Checkout |
Checkout-related wordings (core) |
Shop.Theme.Actions |
Action labels like “Add to cart” (core) |
Shop.Theme.CustomerAccount |
Account page wordings (core) |
Use Shop.Mytheme for your own wordings. Core domains (Shop.Theme.*) are already translated in PrestaShop’s language packs. Reuse them when possible to get translations for free:
{* Uses existing PrestaShop translations, no need to translate yourself *}
{l s='Add to cart' d='Shop.Theme.Actions'}
{l s='No products available yet' d='Shop.Theme.Catalog'}
To use translated strings in your theme’s JavaScript, pass them from a Smarty template as JavaScript variables:
<script>
var myThemeTranslations = {
addedToCart: '{l s="Product added to cart" d="Shop.Mytheme" js=1}',
confirmRemove: '{l s="Are you sure?" d="Shop.Mytheme" js=1}'
};
</script>
The js=1 parameter escapes quotes for safe embedding in JavaScript strings.
Translation involves two distinct steps in “International” > “Translations”:
Under “Add / Update a language”, install the languages you want to support. This downloads PrestaShop’s official language packs, which include translations for all core domains (Shop.Theme.*).
Under “Modify translations”:
.tpl files.Repeat for each language you want to support.
To distribute your theme with translations pre-installed:
.xlf files in your theme’s translations/ directory.When you export your theme, the translations/ folder is included automatically.
See the Smarty helpers reference for the full {l} parameter list.