Skip to content

iOS

iOS uses the system default behavior for localizing user experience. To enable supported language, your application must provide that localization too. Otherwise, the localization will fall back to English.

Info

For additional information on how you can localize your iOS Application, please see the official Apple Documentation.

Changing Localization

To change existing localization, you can utilize the localization hook localizationHandler provided by the Face SDK. This closure is called every time a string is requested.

To see all the localization keys, look up the FaceSDK.strings file at FaceSDK.framework/FaceSDK.bundle/en.lproj/FaceSDK.strings.

Here is an example of how you can add your own CustomLocalization.strings file and override any existing localization provided by the Face SDK:

FaceSDK.service.localizationHandler = { localizationKey in
    // This will look up localization in `CustomLocalization.strings`.
    let result = NSLocalizedString(localizationKey, tableName: "CustomLocalization", comment: "")

    // Localization found in CustomLocalization.
    if result != localizationKey {
        return result
    }

    // By returning nil we fallback to the default localization provided by SDK.
    return nil
}
RFSFaceSDK.service.localizationHandler = ^NSString * _Nullable(NSString * _Nonnull localizationKey) {
    // This will look up localization in `CustomLocalization.strings`.
    NSString *result = NSLocalizedStringFromTable(localizationKey, @"CustomLocalization", @"");

    // Localization found in CustomLocalization.
    if (![result isEqualToString:localizationKey]) {
        return result;
    }

    // By returning nil we fallback to the default localization provided by SDK.
    return nil;
};

Info

See our Catalog App example for additional insight into the implementation.

Back to top