Forcing language selection in your storefront
If you have a multilingual catalog, Ecwid automatically detects the preferred language of your customers’ browsers and shows your store in that language.
In some cases, you might want to add your store in a specific language to a webpage, regardless of the browser language detection. You can force a language by following these steps:
- Enable the necessary language in your store and translate your catalog into it;
- Add the "lang" GET variable to all inclusions of the "script.js" file in Ecwid widgets in the source code of your web page:
<script type="text/javascript" src="https://app.ecwid.com/script.js?
YOUR_STORE_ID&lang=LOCALE_CODE" charset="utf-8">
</script>
Replace YOUR_STORE_ID with your actual Store ID and LOCALE_CODE with the code of the necessary language, for example, en, es, fr, de. See the list of ISO 639-1 language codes to find the two-letter code of the language you wish to force.
Example: You’ve enabled French as an additional language, added your catalog translations into French and wish to show your whole store in French to everyone in a certain site page. In this case, your Ecwid widget in that webpage source code must contain the lang=fr variable:
<script type="text/javascript" src="https://app.ecwid.com/script.js?
1003&lang=fr" charset="utf-8">
</script>
Related articles
Offering your store in multiple languages
Changing your store language
Changing texts in your Ecwid store