{"action":"created","issue":{"url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/299","labels_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/299/labels{/name}","comments_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/299/comments","events_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/299/events","html_url":"https://github.com/jamesarosen/ember-i18n/issues/299","id":104315273,"number":299,"title":"Can't observe `i18n.locale` in a component","user":{"login":"imbrou","id":12932751,"avatar_url":"https://avatars.githubusercontent.com/u/12932751?v=3","gravatar_id":"","url":"https://api.github.com/users/imbrou","html_url":"https://github.com/imbrou","followers_url":"https://api.github.com/users/imbrou/followers","following_url":"https://api.github.com/users/imbrou/following{/other_user}","gists_url":"https://api.github.com/users/imbrou/gists{/gist_id}","starred_url":"https://api.github.com/users/imbrou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imbrou/subscriptions","organizations_url":"https://api.github.com/users/imbrou/orgs","repos_url":"https://api.github.com/users/imbrou/repos","events_url":"https://api.github.com/users/imbrou/events{/privacy}","received_events_url":"https://api.github.com/users/imbrou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-01T17:21:34Z","updated_at":"2015-09-01T17:43:23Z","closed_at":null,"body":"**Hi James, hi Kelly, hi dockyard, hi folks!**\r\n\r\nUsing [Bootstrap 3 tooltips](http://getbootstrap.com/javascript/#tooltips) in a component, I can't find a way to translate its content on a locale change.  \r\n**Component's template:**\r\n```handlebars\r\n<span {{action \"rate\" \"1\"}} data-toggle=\"tooltip\" title={{t \"rateItem.relevancy.-1\"}}>★</span>\r\n```  \r\n**Component's logic:**\r\n```js\r\ni18n: Ember.inject.service(),\r\n\r\n...\r\n\r\ninitTooltips: function() {\r\n   $('[data-toggle=\"tooltip\"]').tooltip() ;\r\n   // empties the elements \"title\" attribute, and sets the tooltips content to its value.\r\n}.on('init').observes('i18n.locale')\r\n```\r\nAs you can see, the Bootstrap API makes use of the HTML `title` attribute to provide a good fallback to classic tooltips if needed. Then of course, to avoid double tooltips, the `$().tooltip()` call saves its content, and empties the attribute.  \r\n**My problem is then the following:**\r\nMy observer on `i18n.locale` is never triggered ; after a language switch, my \"saved\" tooltip content is never updated to the translated one.  \r\nConcretely, after a (English ➜ Dutch) switch, I end up in this situation:\r\n![tooltip-not-translated](https://cloud.githubusercontent.com/assets/12932751/9610844/586f6000-50dc-11e5-85fd-e6b131f94079.png)  \r\nFortunately, sounds like @kellyselden faced [the same problem](https://github.com/dockyard/ember-cli-i18n/issues/48) last year on @dockyard's fork. He even implemented [a nice plugin](https://github.com/kellyselden/ember-cli-i18n-observer) proposing a pretty clean (?) workaround.\r\n\r\n**What about integrating it?** Would somebody else be interested in this feature?"},"comment":{"url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/comments/136808991","html_url":"https://github.com/jamesarosen/ember-i18n/issues/299#issuecomment-136808991","issue_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/299","id":136808991,"user":{"login":"jamesarosen","id":2406,"avatar_url":"https://avatars.githubusercontent.com/u/2406?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesarosen","html_url":"https://github.com/jamesarosen","followers_url":"https://api.github.com/users/jamesarosen/followers","following_url":"https://api.github.com/users/jamesarosen/following{/other_user}","gists_url":"https://api.github.com/users/jamesarosen/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesarosen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesarosen/subscriptions","organizations_url":"https://api.github.com/users/jamesarosen/orgs","repos_url":"https://api.github.com/users/jamesarosen/repos","events_url":"https://api.github.com/users/jamesarosen/events{/privacy}","received_events_url":"https://api.github.com/users/jamesarosen/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T17:43:23Z","updated_at":"2015-09-01T17:43:23Z","body":"I'm surprised the observer doesn't fire on your component. It does in [the helper](https://github.com/jamesarosen/ember-i18n/blob/master/addon/helper.js#L17-L19).\r\n\r\nHow are you switching locales?"}}