function t(path, bindings) {
        let string, isTheme, msg;

        currentLocale = I18n.locale();
        if (bindings !== undefined) {
            isTheme = bindings.isThemeString;
            delete bindings.isThemeString;
        }
        string = I18n.findString(path, {isThemeString: isTheme});

        // If the path returns an array (as in the case with anything that has multiple paragraphs such as emails), then
        // loop through them and return an array of translated/formatted strings. Otherwise, just return the normal
        // translated/formatted string.
        if (Array.isArray(string)) {
            msg = [];
            string.forEach(function (s) {
                let m = new MessageFormat(s, currentLocale);

                try {
                    m.format(bindings);
                } catch (err) {
                    logging.error(err.message);

                    // fallback
                    m = new MessageFormat(coreStrings.errors.errors.anErrorOccurred, currentLocale);
                    m = msg.format();
                }

                msg.push(m);
            });
        } else {
            msg = new MessageFormat(string, currentLocale);

            try {
                msg = msg.format(bindings);
            } catch (err) {
                logging.error(err.message);

                // fallback
                msg = new MessageFormat(coreStrings.errors.errors.anErrorOccurred, currentLocale);
                msg = msg.format();
            }
        }

        return msg;
    }
function t(path, bindings) {
        let string, isTheme, msg;

        currentLocale = I18n.locale();
        if (bindings !== undefined) {
            isTheme = bindings.isThemeString;
            delete bindings.isThemeString;
        }
        string = I18n.findString(path, {isThemeString: isTheme});

        // If the path returns an array (as in the case with anything that has multiple paragraphs such as emails), then
        // loop through them and return an array of translated/formatted strings. Otherwise, just return the normal
        // translated/formatted string.
        if (Array.isArray(string)) {
            msg = [];
            string.forEach(function (s) {
                let m = new MessageFormat(s, currentLocale);

                try {
                    m.format(bindings);
                } catch (err) {
                    logging.error(err.message);

                    // fallback
                    m = new MessageFormat(coreStrings.errors.errors.anErrorOccurred, currentLocale);
                    m = msg.format();
                }

                msg.push(m);
            });
        } else {
            msg = new MessageFormat(string, currentLocale);

            try {
                msg = msg.format(bindings);
            } catch (err) {
                logging.error(err.message);

                // fallback
                msg = new MessageFormat(coreStrings.errors.errors.anErrorOccurred, currentLocale);
                msg = msg.format();
            }
        }

        return msg;
    }
function t ( path , bindings ) { let string , isTheme , msg ; currentLocale = I18n . locale ( ) ; if ( bindings !== undefined ) { isTheme = bindings . isThemeString ; delete bindings . isThemeString ; } string = I18n . findString ( path , { isThemeString : isTheme } ) ; // If the path returns an array (as in the case with anything that has multiple paragraphs such as emails), then // loop through them and return an array of translated/formatted strings. Otherwise, just return the normal // translated/formatted string. if ( Array . isArray ( string ) ) { msg = [ ] ; string . forEach ( function ( s ) { let m = new MessageFormat ( s , currentLocale ) ; try { m . format ( bindings ) ; } catch ( err ) { logging . error ( err . message ) ; // fallback m = new MessageFormat ( coreStrings . errors . errors . anErrorOccurred , currentLocale ) ; m = msg . format ( ) ; } msg . push ( m ) ; } ) ; } else { msg = new MessageFormat ( string , currentLocale ) ; try { msg = msg . format ( bindings ) ; } catch ( err ) { logging . error ( err . message ) ; // fallback msg = new MessageFormat ( coreStrings . errors . errors . anErrorOccurred , currentLocale ) ; msg = msg . format ( ) ; } } return msg ; }
Helper method to find and compile the given data context with a proper string resource.

@param {string} path Path with in the JSON language file to desired string (ie: "errors.init.jsNotBuilt")
@param {object} [bindings]
@returns {string}
Helper method to find and compile the given data context with a proper string resource .
Returns a string that can be used to translate a file.