The following steps to configure Magento 2 Auto Language Switcher:
1. Go to Stores > Configuration > Magefan Extensions > Auto Language Switcher.
2. Enable the extension.
3. Select the Switcher Mode.
Note: this option allows you to Auto Direct customers to the store view in their local language based on their location or displays the Suggestion Popup for customers to choose the store view manually.
4. Choose whether you want to Share Store View Per Website or to set it to be Global.
Note: If you choose to share store views Per Website then customers will be directed to the store views within one website. However, if you choose Global, customers will be directed to the store views from different websites.
e.g. You have one website in English, Spanish, German languages, and the second website in English, Spanish, French. You set to Share Store View Globally. In case a person from France comes to your first website he/she will be redirected to your second website since there is the french store view.
In case you choose the Suggestion Popup Switcher Mode you would additionally need to enter the Suggestion Popup Text that will be displayed on the storefront.
Here is the example of the Suggestion Popup customer will see if you decide to use it:
5. Configure Language Switcher Extension Restrictions.
- Choose the Allowed Pages you want this extension to work for. You can choose All Pages, Specified Pages, and All pages except specified pages.
- In case you choose to allows the extension to work for All Pages, set the User Agents and enter the comma-separated IPs which the extensions should be disabled for.
Whether you choose Specified Pages or All pages except specified pages set the patches of those pages and set the User Agents and IPs that you want extensions to be disabled for.
6. Configure Default Store View By Country.
Select a region and country you are interested in and set the default store-view for it. You can leave default settings to detect store-view based on the customer browser language.
Once all of the configurations have been finished don't forget to press the Save Config button and flush Magento Cache.
There's also a quick walkthrough if you want to see how we configure the language switcher in Magento:
But that's not it. You also have to make sure customers' location is detected properly. So, go to GeoIP Database tab to configure that.
Enter MaxMind Lisence Key if you want to update MaxMind GeoIP Database directly from MaxMind and not via the Magefan server. Also, if you use Cloudflare, Enable Cloudflare IP Geolocation.
Once you finish, save the configuration and test Language Switcher to see how it works for different locations.