As customers use Tweakwise Search on your e-commerce platform, it’s essential to provide the best possible search results while ensuring the user interface is fully adapted to the active language.
Usage
In Tweakwise JS, this can be configured using the lang
option.
window["twn-starter-config"].lang = 'en';
Supported languages
The following table list the languages that Tweakwise supports for our pre-built UI:
Language + code |
---|
English - en |
Dutch - nl |
German - de |
Spanish - es |
French - fr |
Italian - it |
For detailed information on language support in Tweakwise API, see API Language support.
Overriding translations
If you prefer to use a different translation for a predefined language, you can override it using the translations option.
Example: using alternate translations in English
window['twn-starter-config'].translations = {
'en': {
'Add to cart': "Buy now",
'{n} results for {q}': '{n} results'
}
};
Available translation keys can be found in Search & Merchandising Options.
Adding languages
To add a new language, enter the language code in the lang
option (preferably ISO2) and add the corresponding translations to the translations option.
Example: adding Swedish
window['twn-starter-config'].lang = 'sv';
window['twn-starter-config'].translations = {
'sv': {
'Add to cart': "Lägg i varukorgen",
'{n} results for {q}': '{n} resultat för {q}'
}
};
Available translation keys can be found in Search & Merchandising Options.
Tile Editor
Text elements with hardcoded text, added through tile editor are also translatable.
In this case "Add to cart" will be translated to the value configured in the translations: