diff --git a/lib/i18n.js b/lib/i18n.js index 152f4801..6fb9dde1 100644 --- a/lib/i18n.js +++ b/lib/i18n.js @@ -195,6 +195,8 @@ var tagName = attrs.tagName; delete attrs.tagName; + warn("Ember.I18n t helper called with unquoted key: %@. In the future, this will be treated as a bound property, not a string literal.".fmt(key), options.types[0] === 'STRING'); + var translationView = TranslationView.create({ context: attrs, translationKey: key, diff --git a/spec/translateHelperSpec.js b/spec/translateHelperSpec.js index 45525ecd..ec46a0c6 100644 --- a/spec/translateHelperSpec.js +++ b/spec/translateHelperSpec.js @@ -13,6 +13,19 @@ describe('{{t}}', function() { }); }); + it('emits a warning on unquoted keys', function() { + var spy = sinon.spy(Ember.Logger, 'warn'); + + var view = this.renderTemplate('{{t foo.bar}}'); + + Ember.run(function() { + expect(spy.callCount).to.equal(1); + expect(spy.lastCall.args[0]).to.match(/unquoted/); + expect(spy.lastCall.args[0]).to.match(/foo\.bar/); + expect(view.$().text()).to.equal('A Foobar'); + }); + }); + it('interpolates values', function() { var view = this.renderTemplate('{{t "bars.all" count="597"}}');