imports/vx/both/code/util.js
/**
     * Resolve variables within a message template.
     *
     * @param {string} message Message template string.
     * @param {object} params Optional variables to insert into message.
     * @return {string} Message with variables substituted.
     */
Resolve variables within a message template.
@param {string} message Message template string.
@param {object} params Optional variables to insert into message.
@return {string} Message with variables substituted.
Resolve variables within a message template . @param { string } message Message template string . @param { object } params Optional variables to insert into message . @return { string } Message with variables substituted .
i18nResolve(message, params) {
        params = params || {}
        params.system_name = CX.SYSTEM_NAME
        params.system_email = CX.SYSTEM_EMAIL
        _.each(params, (value, key) => {
            if (typeof value === "undefined") {
                value = Util.i18n("common.label_variable_undefined")
            }
            let regexp = new RegExp("\\{\\{" + key + "\\}\\}", "g")
            message = message.replace(regexp, value)
        })
        return message
    }
i18nResolve ( message , params ) { params = params || { } params . system_name = CX . SYSTEM_NAME params . system_email = CX . SYSTEM_EMAIL _ . each ( params , ( value , key ) => { if ( typeof value === "undefined" ) { value = Util . i18n ( "common.label_variable_undefined" ) } let regexp = new RegExp ( "\\{\\{" + key + "\\}\\}" , "g" ) message = message . replace ( regexp , value ) } ) return message }
Resolve variables within a message template.
Resolve variables within a message template .