1

I'm running a multilingual site, and I want the emails sent to the user to be in their language. The scheme I already have is the following:

  1. The website determines the user's country through their IP.
  2. The website redirects the user to the site's version of the language of their country (eg. if the IP detected is from France, then it redirects the user to a WPML french version of the site).

The problem is that I want to have emails translated as well, based on the IP of the user. (eg. the user registers through https://mysite/fr/signup, then the email sent to him for completing his registration should be in French.)

I have WPML and Loco Translate activated for translation, along with Geo Redirect to redirect users to various site's languages.

Is this achievable? and how?

0

I managed to do so using a plugin called IP2Location Redirection, then it worked well for me. It turned out that Geo Redirect hasn't been compatible with latest versions of Wordpress.

0

You can also do that by adding a hidden field in the html form and loading the url as part of the value, something like => <input type="hidden" name="lang" value="<?=$_SERVER['REQUEST_URL']; ?>">

  • Use escaping functions to be on the safe side. E.g. <?php echo esc_url( $_SERVER['REQUEST_URL'] ); ?> – Dave Romsey Mar 7 '18 at 0:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.