Skip to content

Instantly share code, notes, and snippets.

@tylerjohnst
Last active August 29, 2015 14:04
Show Gist options
  • Save tylerjohnst/201f19159bba426096d4 to your computer and use it in GitHub Desktop.
Save tylerjohnst/201f19159bba426096d4 to your computer and use it in GitHub Desktop.
window.I18n = {
pushDictionary: function(translations) {
I18n.translations = Ember.Object.create(translations);
},
t: function(key, opts) {
var translation = I18n.translations.get('en.' + key);
opts = opts || {};
if ( Ember.isEmpty(translation) ) {
return opts.default || "[ missing translation for '%@' ]".fmt(key);
} else {
return translation;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment