utils/i18n.js
function interpolate(val, scope) {

        // if no scope or value with {{ then no interpolation and can just return translated
        if (!scope || !val || !val.match) { return val; }

        // first, we need to get all values with a {{ }} in the string
        var i18nVars = val.match(i18nVarExpr);

        // loop through {{ }} values
        _.each(i18nVars, function (i18nVar) {
            var field = i18nVar.substring(2, i18nVar.length - 2).trim();
            var scopeVal = getScopeValue(scope, field);
            val = val.replace(i18nVar, scopeVal);
        });

        return val;
    }
function interpolate(val, scope) {

        // if no scope or value with {{ then no interpolation and can just return translated
        if (!scope || !val || !val.match) { return val; }

        // first, we need to get all values with a {{ }} in the string
        var i18nVars = val.match(i18nVarExpr);

        // loop through {{ }} values
        _.each(i18nVars, function (i18nVar) {
            var field = i18nVar.substring(2, i18nVar.length - 2).trim();
            var scopeVal = getScopeValue(scope, field);
            val = val.replace(i18nVar, scopeVal);
        });

        return val;
    }
function interpolate ( val , scope ) { // if no scope or value with {{ then no interpolation and can just return translated if ( ! scope || ! val || ! val . match ) { return val ; } // first, we need to get all values with a {{ }} in the string var i18nVars = val . match ( i18nVarExpr ) ; // loop through {{ }} values _ . each ( i18nVars , function ( i18nVar ) { var field = i18nVar . substring ( 2 , i18nVar . length - 2 ) . trim ( ) ; var scopeVal = getScopeValue ( scope , field ) ; val = val . replace ( i18nVar , scopeVal ) ; } ) ; return val ; }
Attempt to interpolate the string
@param val
@param scope
@returns {*}
Attempt to interpolate the string