Localizing the Email Templates

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

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.

Swift:

  • let username = "user_123456"
    let password = "123ABC"
    
    // Create a user.
    let user = KiiUser(username: username, andPassword: password)
    
    // Set the browser locale.
    user.locale = LocaleContainer()
    
    do{
      // Register the user.
      try user.performRegistrationSynchronous()
    } catch let error as NSError {
      // Handle the error.
      return
    }
  • let username = "user_123456"
    let password = "123ABC"
    
    // Create a user.
    let user = KiiUser(username: username, andPassword: password)
    
    // Set the browser locale.
    user.locale = LocaleContainer()
    
    // Register the user.
    user.performRegistration { (user :KiiUser?, error : Error?) -> Void in
      if (error != nil) {
        // Handle the error.
        return
      }
    }

Objective-C:

  • NSString *username = @"user_123456";
    NSString *password = @"123ABC";
    
    NSError *error = nil;
    
    // Create a user.
    KiiUser *user = [KiiUser userWithUsername:username andPassword:password];
    
    // Set the browser locale.
    user.locale = [[LocaleContainer alloc] init];
    
    // Register the user.
    [user performRegistrationSynchronous:&error];
    if (error != nil) {
      // Handle the error.
      return;
    }
  • NSString *username = @"user_123456";
    NSString *password = @"123ABC";
    
    // Create a user.
    KiiUser *user = [KiiUser userWithUsername:username andPassword:password];
    
    // Set the browser locale.
    user.locale = [[LocaleContainer alloc] init];
    
    // Register the user.
    [user performRegistrationWithBlock:^(KiiUser *user, NSError *error) {
      if (error != nil) {
        // Handle the error.
        return;
      }
    }];