How do I localize the language of the password reset email?
951 Views 4 Helpful

Question

How do I localize the language of the password reset email?

Product

  • Registration-as-a-Service (RaaS)

Details

Gigya allows configuring Email Templates[1] for different languages in the Gigya Admin Console. For most emails, such as "New User Welcome", or "Email Verification", the language of the email that will be selected is determined based on the profile.locale field stored for the particular user. However, if this field is not set, it is possible to control this by passing the "lang" parameter to the accounts.resetPassword[2][3] API method.

Answer

The accounts.resetPassword[2][3] API call supports a "lang" parameter that can be used to control which Language template is used to send the email. When using the screen-sets[4], this parameter can be controlled by doing the following:

  1. Add a hidden field to the markup of the "Forgot Password" Screen:

    <input id="passwordResetEmailLang" type="hidden" name="lang" class="gigya-input-text">
  2. Create, or add to, the onAfterScreenLoad Screen-Set Event[5] handler function:

    function onAfterScreenLoadHandler(responseObj) {
      if(responseObj.currentScreen === 'gigya-forgot-password-screen'){
        var passwordResetLang = 'EN'; //control this variable to change the language of the Password Reset Email
        document.getElementById('passwordResetEmailLang').value = passwordResetLang;
      }
    }
  3. Ensure that the event handler function is linked to the onAfterScreenLoad Screen-Set Event:

    var params ={
      screenSet: 'Default-RegistrationLogin',
      onAfterScreenLoad: onAfterScreenLoadHandler
    };
    
    gigya.accounts.showScreenSet(params); 

Note: The "lang" parameter is only valid if the user's "profile.locale" field is not set. Otherwise, it will be ignored.

Links

[1]: http://developers.gigya.com/display/GD/Email+Templates
[2]: http://developers.gigya.com/display/GD/accounts.resetPassword+REST
[3]: http://developers.gigya.com/display/GD/accounts.resetPassword+JS
[4]: http://developers.gigya.com/display/GD/Screen-Sets
[5]: http://developers.gigya.com/display/GD/accounts.showScreenSet+JS#accounts.showScreenSetJS-Events

Was this article helpful?