Using the Automatic User Language Detection Add-on for TranslatePress, users will be redirected to their preferred language.
First-time visitors will be redirected to their preferred language based on their browser settings or IP address. The language is then saved in a cookie so that any time they return to the website, they will be automatically redirected to their last visited language.
Install the Automatic User Language Detection Add-on
Install and activate a premium version of TranslatePress (Business or Developer). Once installed, go to Settings → TranslatePress in your WordPress dashboard, and then navigate to the Addons tab.
Scroll down to the Automatic User Language Detection Add-on and Activate it here.
Configure your menu items
The settings for the Automatic User Language Detection Addon were moved to the Advanced Settings Tab.
You can choose what method to be considered: their browser language setting, or their IP address.
Selecting the option First by browser language, then IP address will consider the user’s browser language setting. If it doesn’t match any of the site’s available languages selected in TranslatePress settings, then the IP address of the user will be used to determine its preferred language. If this doesn’t match any of the available languages either, then the default language will be displayed to the user or, if the option Use subdirectory for default language is set to Yes, the first language in the Translation Languages option.
Similarly, selecting the option First by IP address, then browser language will determine the language by IP and if that fails then browser language is considered.
Selecting Only by browser language or Only by IP address will not have a fallback user language detection method.
IP address based language
The visitor’s IP address is searched in the GeoLite2 database to determine the country from which the user accessed the website. The country is then searched in the locales code of the selected translation languages in TranslatePress Settings.
This product includes GeoLite2 data created by MaxMind.
Pop-up and Hello Bar
Using the Redirect Directly option may cause indexing issues for Google so we recommend trying one of the pop-ups options to solve this problem. The Pop-ups notify the user when a different language is detected by the Automatic User Language Detection Addon instead of redirecting directly and asking them if they want to be redirected to the detected Language or another language available on the website.
All the text appearing in the Pop-ups is appended dynamically and can be changed from the settings. As it can be seen in the picture, the text can be changed to something else easily and the modifications will be visible in the pop-ups. Also, the text will not be affected by the automatic translation so, if you wish for the text to be in a different language, it can be changed to any language you wish to appear inside the pop-ups.
We have two types of pop-ups available to use that can be chosen from the “Select the type of pop-up you wish to appear” setting. The pop-ups available are a pop-up window over the content and a hello bar before the content. The changes made for the text appearing in the pop-up, change language button and the close button will be reflected on both of these designs.
Pop-up window over the content
The pop-up window is the best choice available for notifying the user about a different detected language. The language switcher appended to the pop-up will show the detected language inside the closed language switcher. If the user wants to be redirected to the detected language, they will click the Change Language button and be redirected. The language cookie will be changed so the pop-up is not shown again on different pages. The pop-up window stays at the top of the page while scrolling and while it is opened the content available on the pages can still be seen or clicked.
As said before, all the text appended to the pop-up is appended depending on the text chosen in the settings and can be changed.
If the user wants to be redirected to a different language available on the website, they can do so by opening the language switcher and choosing a different language. Just like with the detected language, the language cookie is changed to the chosen language and the pop-up will not appear again.
There is also the option to just close the pop-up without switching languages.
Hello Bar before the content
The Hello Bar is displayed before the content. It has a similar design to the pop-up window but, because it is displayed before the content, it will not remain at the top of the page while scrolling.
As the pop-up window, the Hello Bar has a language switcher appended that lets the user choose from all the languages available on the website. The language displayed when the language switcher is closed is the one detected by the addon.
Similar to the pop-up, the text appearing inside the hello bar can be changed from the settings. Make sure to test how the Hello Bar is displayed in the front-end. Themes and other plugins may also have elements in the same place so it’s best to check how these interact.
Both designs of pop-ups are responsive and will adapt well to changes in window size or on mobile phones.
Google understands browser language redirection and will redirect your users to the specific language URL.
Google can index your site for various IP addresses, but there’s no guarantee for how these redirects will affect your site indexing. This is happening because Google frequently updates its indexing algorithms, so nobody knows exactly how these are working.
You can use Google Webmaster Tool to see how is your site indexed. Also, we recommend reviewing your index status from Webmaster Tool periodically.
One of the best methods to show your users that you have content in their language is to place a language switcher on your site.
Another way could be to first ask your users about the language that they prefer through a welcome page and then show them relevant content in that language.
Get Automatic User Language Detection Add-on