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" variable to all inclusions of the "script.js" file in Ecwid widgets that you have 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>
Instead of LOCALE_CODE you should put the two-letter code of the language that you want to use on this page — for example, en for English, es for Spanish, fr for French, de for German, etc (also, make sure that instead of YOUR_STORE_ID there is your actual Store ID.)
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