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 user device with the Locale#getDefault() method. When setting the locale in the KiiUser, please use an instance of the LocaleContainer class as shown in the next snippet. The LocaleContainer class will convert the format of the locale from the platform-specific one to the common one that can be interpreted by the server.

  • String password = "123456";
    
    // Create a user.
    KiiUser user = KiiUser.builderWithName("user_123456").build();
    
    // Set the browser locale.
    user.setLocale(new LocaleContainer(Locale.getDefault()));
    
    try {
      // Register the user.
      user.register(password);
    } catch (AppException e) {
      // Handle the error.
    } catch (IOException e) {
      // Handle the error.
    }
  • String password = "123456";
    
    // Create a user.
    KiiUser user = KiiUser.builderWithName("user_123456").build();
    
    // Set the browser locale.
    user.setLocale(new LocaleContainer(Locale.getDefault()));
    
    // Register the user.
    user.register(new KiiUserCallBack() {
      @Override
      public void onRegisterCompleted(int token, KiiUser user, Exception exception) {
        if (exception != null) {
          // Handle the error.
          return;
        }
      }
    }, password);