Mixing chrome.i18n (internationalization method) into templates I'm mixing chrome.i18n into my templates as templateHelpers with Backbone.Marionette.

templateHelpers: function () {
    return {
        //  Mix in chrome to reference internationalize.
        'chrome.i18n': chrome.i18n,
        instant: this.instant
    };
}


and here's my template:

&lt;% if( instant ) { %&gt;
    &lt;img class="item-thumb" src="http://img.youtube.com/vi/&lt;%= video.get('id') %&gt;/default.jpg" /&gt;
&lt;% } else { %&gt;
    &lt;img class="item-thumb" data-original="http://img.youtube.com/vi/&lt;%= video.get('id') %&gt;/default.jpg" /&gt;
&lt;% } %&gt;

&lt;span class="item-title" title="&lt;%= video.get('title') %&gt;"&gt;&lt;%= video.get('title') %&gt;&lt;/span&gt;

&lt;span class="item-details"&gt;
    &lt;% if( video.get('highDefinition') ) { %&gt;
        &lt;%= chrome.i18n.getMessage('hd') %&gt; · 
    &lt;% } %&gt;
    &lt;span class="item-duration"&gt;
        &lt;%= video.get('prettyDuration') %&gt;  
    &lt;/span&gt;
&lt;/span&gt;

&lt;span class="hover-actions"&gt;
    &lt;button class="button-icon playInStream" title="&lt;%= chrome.i18n.getMessage('play') %&gt;"&gt;
        &lt;i class="fa fa-play"&gt;&lt;/i&gt;
    &lt;/button&gt;

    &lt;button class="button-icon addToStream" title="&lt;%= chrome.i18n.getMessage('enqueue') %&gt;"&gt;
        &lt;i class="fa fa-plus"&gt;&lt;/i&gt;
    &lt;/button&gt;

    &lt;button class="button-icon save" title="&lt;%= chrome.i18n.getMessage('save') %&gt;"&gt;
        &lt;i class="fa fa-save"&gt;&lt;/i&gt;
    &lt;/button&gt;
&lt;/span&gt;


The number of templates being rendered could well be in the thousands. Would it be greatly more efficient to pass the strings themselves into the template, i.e. call getMessage inside of templateHelpers, or does it not make much of a difference at all? My thought is that since I don't use the rest of chrome.i18n, I shouldn't be serializing it, but I'm not sure if that's the case.
I doubt performance will take much of a hit by passing chrome.i18n into your templates, but I still don't think you should do it.

Templates should be solely for visualising data where possible, sometimes this requires a small amount of logic, but you should keep it out whenever possible. I would much rather see this:

var i18n = chrome.i18n;

...

templateHelpers: function () {
    return {
        hdMessage: i18n.getMessage('hd'),
        instant: this.instant
    };
}


-

&lt;% if( video.get('highDefinition') ) { %&gt;
    &lt;%= hdMessage %&gt; · 
&lt;% } %&gt;


In the long run this prevents your templates from being cluttered with internationalisation specific code, which will also be useful if you ever need to change the library.