Localizing Triage Options

If your license includes multiple languages you should specify translated strings for each overridden and extended triage option in app/config.js. The default set of triage options provided in SCWebcore.triage already include translations for all supported languages.

var triageOptions = parseOptions([{
    'level_min': 100,
    'level_max': 100,
    'button_text': {
        en: 'Call 911',
        es: 'Llamá al 911',
        'fr-CA': 'Appeler le 911'
    },
    'icon': 'fa fa-phone',
    'url': 'tel:911'
}, {
    'level_min': 95,
    'level_max': 95,
    'button_text': {
        en: 'Find an ER',
        es: 'Encuentre un ER',
        'fr-CA': 'Trouver un ER'
    },
    'icon': 'fa fa-hospital-o',
    'url': 'https://www.google.com/maps/search/Emergency+Room/'
},...])

Note that the parseOptions function in the above block is responsible for casting each of these JSON objects as a TriageOption instance.

Example Implementation

Localized strings should be provided to all custom triage options defined in SCWebCore.triage.extendTriageOptions and SCWebCore.triage.setTriageOptions as specified in app/config.js.

The specified format for defining localized strings for triage options is as follows, where each property is supplied a key:value pair of translations using the supported locale codes (defined in SCWebCore.locale.SupportedLocales) as the key:

    'button_text': {
        en: 'English button text',
        es: 'Spanish button text',
        'fr-CA': 'French button text'
    }

In Extending Triage Options we extended the default triage rules in app/config.js. In order to support alternate languages, we are required to provide localized strings for button_text as shown below:

angular.module('core').run(['SCWebCore', function(SCWebCore) {
    SCWebCore.triage.extendTriageOptions([{
        'level_min': 0,
        'level_max': 90,
        'button_text': {
            en: 'AppCatalyst Connect',
            es: 'AppCatalyst Conectar',
            'fr-CA': 'AppCatalyst Relier'
        },
        'button_class': 'btn-primary',
        'icon': 'fa fa-asterisk',
        'url': 'https://www.appcatalyst.com/app-catalyst/'
    }])
}])

See Extending Triage Options or Overriding Triage Options for examples of how triage options are defined in the example application.