UR Code Template - Text & Language Customization

Learn how to localize strings in the UR Code Templates.


Localizing Strings

The strings in the UR Code Templates can be localized by using the configureURCodeTemplateLocalization API. This API uses a Template JSON object, such as the Sample App's FaceTec_UR_Code_Templates_Customization.json, to localize all UR Code Template Strings.

Important Note: FaceTec_UR_Code_Templates_Customization.json contains the latest Field Keys and Field Display Labels from FaceTec's UR Code Templates.
Localization Example:

The Field Display Label for a Full Name can be updated to Portuguese (i.e. to "Nome Completo) by updating the fieldKey and fieldDisplayLabel to the following in FaceTec_UR_Code_Templates_Customization.json:

{
    "fieldKey": "FullName",
    "fieldDisplayLabel": "Nome Completo"
}

Setting the SDK Localization

The UR Code Template Customization JSON is used to control the Field Labels that are displayed. The Fields and Field Labels are dependent on the Metadata and UR Code Template that is used for a given UR Code. For instance, if Your Team wants the UR Scan+Match UI to show "DOB" instead of "Date of Birth", or if Your Team wants to localize "Name" (or any other field) to a different language, Your Team must configure a UR Code Template Customization JSON and call configureURCodeTemplateLocalization to set these configurations.

If a UR Code is scanned and a given field for a given template does not have a set configuration, the default English String will be used. To set different customizations based on the User's Device Language, Your Team must first determine the language, then call configureURCodeTemplateLocalization and pass in the properly localized UR Code Template Customization JSON for the language that Your Team would like to display.

Android Example:
try {
    InputStream is = context.getAssets().open("FaceTec_UR_Code_Templates_Customization.json");
    byte[] buffer = new byte[is.available()];
    is.read(buffer);
    is.close();
    String urCodeTemplateLocalizationJSONString = new String(buffer, "UTF-8");
    JSONObject urCodeTemplateLocalizationJSON = new JSONObject(urCodeTemplateLocalizationJSONString);
    FaceTecURScanMatchSDK.configureURCodeTemplateLocalization(urCodeTemplateLocalizationJSON);
} catch (IOException | JSONException ex) {
    // Handle error parsing JSON file
}
iOS Example:
if let path = Bundle.main.path(forResource: "FaceTec_UR_Code_Templates_Customization", ofType: "json") {
    do {
        let jsonData = try Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe)
        let jsonObject = try JSONSerialization.jsonObject(with: jsonData, options: .mutableLeaves)
        if let jsonDictionary = jsonObject as? Dictionary<String, AnyObject> {
            FaceTecURScanMatchSDK.configureURCodeTemplateLocalization(dictionary: jsonDictionary)
        }
    } catch {
        // Handle error parsing JSON file
    }
}
Browser Example:

Coming Soon!