How to use the setExtension function from swig
Find comprehensive JavaScript swig.setExtension code examples handpicked from public code repositorys.
GitHub: logie17/swig-i18n
57 58 59 60 61 62 63 64 65
} else { return translations && tag && language && translations[tag] && translations[tag][language] ? translations[tag][language] : defaultTranslation; } } swig.setExtension('i18n', function(ctx, tag, default_translation) { var language = ctx.i18n ? ctx.i18n.language : 'unknown'; return translate(tag, language, default_translation); });
4
4
0
3550 3551 3552 3553 3554 3555 3556 3557 3558 3559
/** * Add extensions for custom tags. This allows any custom tag to access a globally available methods via a special globally available object, <var>_ext</var>, in templates. * * @example * swig.setExtension('trans', function (v) { return translate(v); }); * function compileTrans(compiler, args, content, parent, options) { * return '_output += _ext.trans(' + args[0] + ');' * }; * swig.setTag('trans', parseTrans, compileTrans, true);
0
1
0
GitHub: logie17/swig-cldr
37 38 39 40 41 42 43 44 45 46
var parseToken = function (token) { var match = token.match; this.out.push(match); }; swig.setExtension('currency', function(ctx, value) { var cldr = buildCldr(ctx); var currency; if (ctx && ctx.i18n && ctx.i18n.currency_code){
0
0
0
+ 2 other calls in file
swig.compileFile is the most popular function in swig (1638 examples)