{"action":"created","comment":{"url":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/comments/33427829","id":33427829,"diff_hunk":"@@ -25,8 +25,12 @@ export default Parent.extend(Ember.Evented, {\n   t: function(key, data = {}) {\n     const locale = this.get('_locale');\n     Ember.assert(\"I18n: Cannot translate when locale is null\", locale);\n+    const count = get(data, 'count');\n \n-    const template = locale.getCompiledTemplate(key, get(data, 'count'));\n+    let defaults = makeArray(get(data, 'default'));\n+\n+    defaults.unshift(key);\n+    let template = locale.getCompiledTemplate(defaults, count);","path":"addon/service.js","position":19,"original_position":19,"commit_id":"860b5b3ee0906f509c32377413f40d49713ba5c1","original_commit_id":"860b5b3ee0906f509c32377413f40d49713ba5c1","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},"body":"ibid","created_at":"2015-06-28T22:36:52Z","updated_at":"2015-06-28T22:36:52Z","html_url":"https://github.com/jamesarosen/ember-i18n/pull/230#discussion_r33427829","pull_request_url":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/230","_links":{"self":{"href":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/comments/33427829"},"html":{"href":"https://github.com/jamesarosen/ember-i18n/pull/230#discussion_r33427829"},"pull_request":{"href":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/230"}}},"pull_request":{"url":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/230","id":37452446,"html_url":"https://github.com/jamesarosen/ember-i18n/pull/230","diff_url":"https://github.com/jamesarosen/ember-i18n/pull/230.diff","patch_url":"https://github.com/jamesarosen/ember-i18n/pull/230.patch","issue_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/230","number":230,"state":"open","locked":false,"title":"[Feature] Allow to pass an array of fallback translations","user":{"login":"cibernox","id":265339,"avatar_url":"https://avatars.githubusercontent.com/u/265339?v=3","gravatar_id":"","url":"https://api.github.com/users/cibernox","html_url":"https://github.com/cibernox","followers_url":"https://api.github.com/users/cibernox/followers","following_url":"https://api.github.com/users/cibernox/following{/other_user}","gists_url":"https://api.github.com/users/cibernox/gists{/gist_id}","starred_url":"https://api.github.com/users/cibernox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cibernox/subscriptions","organizations_url":"https://api.github.com/users/cibernox/orgs","repos_url":"https://api.github.com/users/cibernox/repos","events_url":"https://api.github.com/users/cibernox/events{/privacy}","received_events_url":"https://api.github.com/users/cibernox/received_events","type":"User","site_admin":false},"body":"I'm need to create a helper that translates error messages following the same conventions that rails-i18n uses for translate error messages in active record.\r\n\r\nFor those not familiar with rails-i18n, the fallback chain that it uses is like this (being `Admin` a subclass of `User`)\r\n```\r\nactiverecord.errors.models.admin.attributes.name.blank\r\nactiverecord.errors.models.admin.blank\r\nactiverecord.errors.models.user.attributes.name.blank\r\nactiverecord.errors.models.user.blank\r\nactiverecord.errors.messages.blank\r\nerrors.attributes.name.blank\r\nerrors.messages.blank\r\n```\r\n\r\nWhile this is specific of my in progress meta-addon (addon built on top of ember-i18n :boom: ), the ability of having fallback translations is a must for me and I think general purpose feature. \r\n\r\nATM i need to compare if the returned string matches the regular expression `/Missing translation/` or alternatively use the private API `i18n._locale`.\r\n\r\nThe downside of this change is that `fallbacks` becomes keyword-ish. I'm open to other ideas about how to implement this.","created_at":"2015-06-11T11:12:13Z","updated_at":"2015-06-28T22:36:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d59a8ca6dee20dbab550fdcae290a5d4131242f5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/230/commits","review_comments_url":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/230/comments","review_comment_url":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/230/comments","statuses_url":"https://api.github.com/repos/jamesarosen/ember-i18n/statuses/860b5b3ee0906f509c32377413f40d49713ba5c1","head":{"label":"cibernox:allow-array-of-fallbacks","ref":"allow-array-of-fallbacks","sha":"860b5b3ee0906f509c32377413f40d49713ba5c1","user":{"login":"cibernox","id":265339,"avatar_url":"https://avatars.githubusercontent.com/u/265339?v=3","gravatar_id":"","url":"https://api.github.com/users/cibernox","html_url":"https://github.com/cibernox","followers_url":"https://api.github.com/users/cibernox/followers","following_url":"https://api.github.com/users/cibernox/following{/other_user}","gists_url":"https://api.github.com/users/cibernox/gists{/gist_id}","starred_url":"https://api.github.com/users/cibernox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cibernox/subscriptions","organizations_url":"https://api.github.com/users/cibernox/orgs","repos_url":"https://api.github.com/users/cibernox/repos","events_url":"https://api.github.com/users/cibernox/events{/privacy}","received_events_url":"https://api.github.com/users/cibernox/received_events","type":"User","site_admin":false},"repo":{"id":37248505,"name":"ember-i18n","full_name":"cibernox/ember-i18n","owner":{"login":"cibernox","id":265339,"avatar_url":"https://avatars.githubusercontent.com/u/265339?v=3","gravatar_id":"","url":"https://api.github.com/users/cibernox","html_url":"https://github.com/cibernox","followers_url":"https://api.github.com/users/cibernox/followers","following_url":"https://api.github.com/users/cibernox/following{/other_user}","gists_url":"https://api.github.com/users/cibernox/gists{/gist_id}","starred_url":"https://api.github.com/users/cibernox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cibernox/subscriptions","organizations_url":"https://api.github.com/users/cibernox/orgs","repos_url":"https://api.github.com/users/cibernox/repos","events_url":"https://api.github.com/users/cibernox/events{/privacy}","received_events_url":"https://api.github.com/users/cibernox/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cibernox/ember-i18n","description":"","fork":true,"url":"https://api.github.com/repos/cibernox/ember-i18n","forks_url":"https://api.github.com/repos/cibernox/ember-i18n/forks","keys_url":"https://api.github.com/repos/cibernox/ember-i18n/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cibernox/ember-i18n/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cibernox/ember-i18n/teams","hooks_url":"https://api.github.com/repos/cibernox/ember-i18n/hooks","issue_events_url":"https://api.github.com/repos/cibernox/ember-i18n/issues/events{/number}","events_url":"https://api.github.com/repos/cibernox/ember-i18n/events","assignees_url":"https://api.github.com/repos/cibernox/ember-i18n/assignees{/user}","branches_url":"https://api.github.com/repos/cibernox/ember-i18n/branches{/branch}","tags_url":"https://api.github.com/repos/cibernox/ember-i18n/tags","blobs_url":"https://api.github.com/repos/cibernox/ember-i18n/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cibernox/ember-i18n/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cibernox/ember-i18n/git/refs{/sha}","trees_url":"https://api.github.com/repos/cibernox/ember-i18n/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cibernox/ember-i18n/statuses/{sha}","languages_url":"https://api.github.com/repos/cibernox/ember-i18n/languages","stargazers_url":"https://api.github.com/repos/cibernox/ember-i18n/stargazers","contributors_url":"https://api.github.com/repos/cibernox/ember-i18n/contributors","subscribers_url":"https://api.github.com/repos/cibernox/ember-i18n/subscribers","subscription_url":"https://api.github.com/repos/cibernox/ember-i18n/subscription","commits_url":"https://api.github.com/repos/cibernox/ember-i18n/commits{/sha}","git_commits_url":"https://api.github.com/repos/cibernox/ember-i18n/git/commits{/sha}","comments_url":"https://api.github.com/repos/cibernox/ember-i18n/comments{/number}","issue_comment_url":"https://api.github.com/repos/cibernox/ember-i18n/issues/comments{/number}","contents_url":"https://api.github.com/repos/cibernox/ember-i18n/contents/{+path}","compare_url":"https://api.github.com/repos/cibernox/ember-i18n/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cibernox/ember-i18n/merges","archive_url":"https://api.github.com/repos/cibernox/ember-i18n/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cibernox/ember-i18n/downloads","issues_url":"https://api.github.com/repos/cibernox/ember-i18n/issues{/number}","pulls_url":"https://api.github.com/repos/cibernox/ember-i18n/pulls{/number}","milestones_url":"https://api.github.com/repos/cibernox/ember-i18n/milestones{/number}","notifications_url":"https://api.github.com/repos/cibernox/ember-i18n/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cibernox/ember-i18n/labels{/name}","releases_url":"https://api.github.com/repos/cibernox/ember-i18n/releases{/id}","created_at":"2015-06-11T08:19:46Z","updated_at":"2015-06-11T08:19:46Z","pushed_at":"2015-06-28T20:12:15Z","git_url":"git://github.com/cibernox/ember-i18n.git","ssh_url":"git@github.com:cibernox/ember-i18n.git","clone_url":"https://github.com/cibernox/ember-i18n.git","svn_url":"https://github.com/cibernox/ember-i18n","homepage":"","size":1575,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jamesarosen:master","ref":"master","sha":"684bbfbc29352edda54111818490a7475f8252d9","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},"repo":{"id":2476855,"name":"ember-i18n","full_name":"jamesarosen/ember-i18n","owner":{"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},"private":false,"html_url":"https://github.com/jamesarosen/ember-i18n","description":"","fork":false,"url":"https://api.github.com/repos/jamesarosen/ember-i18n","forks_url":"https://api.github.com/repos/jamesarosen/ember-i18n/forks","keys_url":"https://api.github.com/repos/jamesarosen/ember-i18n/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jamesarosen/ember-i18n/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jamesarosen/ember-i18n/teams","hooks_url":"https://api.github.com/repos/jamesarosen/ember-i18n/hooks","issue_events_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/events{/number}","events_url":"https://api.github.com/repos/jamesarosen/ember-i18n/events","assignees_url":"https://api.github.com/repos/jamesarosen/ember-i18n/assignees{/user}","branches_url":"https://api.github.com/repos/jamesarosen/ember-i18n/branches{/branch}","tags_url":"https://api.github.com/repos/jamesarosen/ember-i18n/tags","blobs_url":"https://api.github.com/repos/jamesarosen/ember-i18n/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jamesarosen/ember-i18n/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jamesarosen/ember-i18n/git/refs{/sha}","trees_url":"https://api.github.com/repos/jamesarosen/ember-i18n/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jamesarosen/ember-i18n/statuses/{sha}","languages_url":"https://api.github.com/repos/jamesarosen/ember-i18n/languages","stargazers_url":"https://api.github.com/repos/jamesarosen/ember-i18n/stargazers","contributors_url":"https://api.github.com/repos/jamesarosen/ember-i18n/contributors","subscribers_url":"https://api.github.com/repos/jamesarosen/ember-i18n/subscribers","subscription_url":"https://api.github.com/repos/jamesarosen/ember-i18n/subscription","commits_url":"https://api.github.com/repos/jamesarosen/ember-i18n/commits{/sha}","git_commits_url":"https://api.github.com/repos/jamesarosen/ember-i18n/git/commits{/sha}","comments_url":"https://api.github.com/repos/jamesarosen/ember-i18n/comments{/number}","issue_comment_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/comments{/number}","contents_url":"https://api.github.com/repos/jamesarosen/ember-i18n/contents/{+path}","compare_url":"https://api.github.com/repos/jamesarosen/ember-i18n/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jamesarosen/ember-i18n/merges","archive_url":"https://api.github.com/repos/jamesarosen/ember-i18n/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jamesarosen/ember-i18n/downloads","issues_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues{/number}","pulls_url":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls{/number}","milestones_url":"https://api.github.com/repos/jamesarosen/ember-i18n/milestones{/number}","notifications_url":"https://api.github.com/repos/jamesarosen/ember-i18n/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jamesarosen/ember-i18n/labels{/name}","releases_url":"https://api.github.com/repos/jamesarosen/ember-i18n/releases{/id}","created_at":"2011-09-28T18:16:28Z","updated_at":"2015-06-28T12:10:38Z","pushed_at":"2015-06-28T20:12:16Z","git_url":"git://github.com/jamesarosen/ember-i18n.git","ssh_url":"git@github.com:jamesarosen/ember-i18n.git","clone_url":"https://github.com/jamesarosen/ember-i18n.git","svn_url":"https://github.com/jamesarosen/ember-i18n","homepage":"","size":5094,"stargazers_count":540,"watchers_count":540,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":112,"mirror_url":null,"open_issues_count":13,"forks":112,"open_issues":13,"watchers":540,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/230"},"html":{"href":"https://github.com/jamesarosen/ember-i18n/pull/230"},"issue":{"href":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/230"},"comments":{"href":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/230/comments"},"review_comments":{"href":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/230/comments"},"review_comment":{"href":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jamesarosen/ember-i18n/pulls/230/commits"},"statuses":{"href":"https://api.github.com/repos/jamesarosen/ember-i18n/statuses/860b5b3ee0906f509c32377413f40d49713ba5c1"}}}}