Skip to content

Instantly share code, notes, and snippets.

@wagenet
Created February 18, 2015 00:17
Show Gist options
  • Save wagenet/d11775dcc11bf09d410c to your computer and use it in GitHub Desktop.
Save wagenet/d11775dcc11bf09d410c to your computer and use it in GitHub Desktop.
import Stream from 'ember-cli-i18n/utils/stream';
import t from 'ember-cli-i18n/utils/t';
import Ember from 'ember';
// tHelper without the container and application dependencies, sigh...
function tHelper(params /*, hash, options, env */) {
var path = params.shift();
var stream = new Stream(function() {
return t(path, params);
});
// bind any arguments that are Streams
for (var i = 0, l = params.length; i < l; i++) {
var param = params[i];
if(param && param.isStream){
param.subscribe(stream.notify, stream);
}
}
if (path.isStream) {
path.subscribe(stream.notify, stream);
}
return stream;
}
export function registerI18N() {
// Yay, private APIs!
Ember.HTMLBars._registerHelper('t', tHelper);
}
@eibrahim
Copy link

eibrahim commented May 6, 2015

where do you put this code?

@soeffing
Copy link

soeffing commented May 7, 2015

Yeah, I am wondering the same!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment