Localizing the Email Templates

By setting a user locale, you can switch the email templates used in the verification process.

You can get the locale of the browser from the browser's navigator object.

  • var username = "user_123456";
    var password = "123ABC";
    
    // Create a user.
    var user = KiiUser.userWithUsername(username, password);
    
    // Set the browser locale.
    var locale = (navigator.browserLanguage || navigator.language || navigator.userLanguage);
    user.setLocale(locale);
    
    // Register the user.
    user.register({
      success: function(theUser) {
        // Do something.
      },
      failure: function(theUser, errorString) {
        // Handle the error.
      }
    });
  • var username = "user_123456";
    var password = "123ABC";
    
    // Create a user.
    var user = KiiUser.userWithUsername(username, password);
    
    // Set the browser locale.
    var locale = (navigator.browserLanguage || navigator.language || navigator.userLanguage);
    user.setLocale(locale);
    
    // Register the user.
    user.register().then(
      function(theUser) {
        // Do something.
      }
    ).catch(
      function(error) {
        // Handle the error.
        var theUser = error.target;
        var errorString = error.message;
      }
    );