{"action":"created","comment":{"url":"https://api.github.com/repos/i-am-tom/schemer/pulls/comments/85200092","pull_request_review_id":5929253,"id":85200092,"diff_hunk":"@@ -78,8 +78,19 @@\n                 (new Text)\n                     ->email()\n                     ->validate('test.com')\n-                    ->errors()\n-            )->toBe(['not an email']);\n+                    ->errors()[0]\n+                    ->__toString()\n+            )->toBe('not an email');\n+        });\n+\n+        it('can be translated', function () {\n+            expect(\n+                (new Text)\n+                    ->email()\n+                    ->validate('test.com')\n+                    ->errors()[0]\n+                    ->translate('hello')","path":"test/Validator/Text.php","position":17,"original_position":17,"commit_id":"02a016d0af6ae065a6d803b2e31e8bc7ef710315","original_commit_id":"02a016d0af6ae065a6d803b2e31e8bc7ef710315","user":{"login":"imjoehaines","id":282732,"avatar_url":"https://avatars.githubusercontent.com/u/282732?v=3","gravatar_id":"","url":"https://api.github.com/users/imjoehaines","html_url":"https://github.com/imjoehaines","followers_url":"https://api.github.com/users/imjoehaines/followers","following_url":"https://api.github.com/users/imjoehaines/following{/other_user}","gists_url":"https://api.github.com/users/imjoehaines/gists{/gist_id}","starred_url":"https://api.github.com/users/imjoehaines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imjoehaines/subscriptions","organizations_url":"https://api.github.com/users/imjoehaines/orgs","repos_url":"https://api.github.com/users/imjoehaines/repos","events_url":"https://api.github.com/users/imjoehaines/events{/privacy}","received_events_url":"https://api.github.com/users/imjoehaines/received_events","type":"User","site_admin":false},"body":"So I was thinking of adding a new method to `Result` that maps over the list of errors and calls translate on each one, with some logic to match tokens. i.e.\r\n\r\n```php\r\n$result = $validator->validate($stuff);\r\n\r\n$errors = $result->translate(['NOT_EMAIL' => 'hey', 'NOT_ALPHANUMERIC' => 'no']);\r\n```","created_at":"2016-10-26T19:22:38Z","updated_at":"2016-10-26T19:22:38Z","html_url":"https://github.com/i-am-tom/schemer/pull/12#discussion_r85200092","pull_request_url":"https://api.github.com/repos/i-am-tom/schemer/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/i-am-tom/schemer/pulls/comments/85200092"},"html":{"href":"https://github.com/i-am-tom/schemer/pull/12#discussion_r85200092"},"pull_request":{"href":"https://api.github.com/repos/i-am-tom/schemer/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/i-am-tom/schemer/pulls/12","id":91065820,"html_url":"https://github.com/i-am-tom/schemer/pull/12","diff_url":"https://github.com/i-am-tom/schemer/pull/12.diff","patch_url":"https://github.com/i-am-tom/schemer/pull/12.patch","issue_url":"https://api.github.com/repos/i-am-tom/schemer/issues/12","number":12,"state":"open","locked":false,"title":"Make validation errors translatable","user":{"login":"imjoehaines","id":282732,"avatar_url":"https://avatars.githubusercontent.com/u/282732?v=3","gravatar_id":"","url":"https://api.github.com/users/imjoehaines","html_url":"https://github.com/imjoehaines","followers_url":"https://api.github.com/users/imjoehaines/followers","following_url":"https://api.github.com/users/imjoehaines/following{/other_user}","gists_url":"https://api.github.com/users/imjoehaines/gists{/gist_id}","starred_url":"https://api.github.com/users/imjoehaines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imjoehaines/subscriptions","organizations_url":"https://api.github.com/users/imjoehaines/orgs","repos_url":"https://api.github.com/users/imjoehaines/repos","events_url":"https://api.github.com/users/imjoehaines/events{/privacy}","received_events_url":"https://api.github.com/users/imjoehaines/received_events","type":"User","site_admin":false},"body":"I'm not sure how much I like this interface so can you take a look? There's still some work to make this not a bc break and to allow overwriting all error messages of the same type.","created_at":"2016-10-26T18:55:52Z","updated_at":"2016-10-26T19:22:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f77e3e0a5b512ba57a50599d9b5444df8db92901","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/i-am-tom/schemer/pulls/12/commits","review_comments_url":"https://api.github.com/repos/i-am-tom/schemer/pulls/12/comments","review_comment_url":"https://api.github.com/repos/i-am-tom/schemer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/i-am-tom/schemer/issues/12/comments","statuses_url":"https://api.github.com/repos/i-am-tom/schemer/statuses/02a016d0af6ae065a6d803b2e31e8bc7ef710315","head":{"label":"imjoehaines:translatable-errors","ref":"translatable-errors","sha":"02a016d0af6ae065a6d803b2e31e8bc7ef710315","user":{"login":"imjoehaines","id":282732,"avatar_url":"https://avatars.githubusercontent.com/u/282732?v=3","gravatar_id":"","url":"https://api.github.com/users/imjoehaines","html_url":"https://github.com/imjoehaines","followers_url":"https://api.github.com/users/imjoehaines/followers","following_url":"https://api.github.com/users/imjoehaines/following{/other_user}","gists_url":"https://api.github.com/users/imjoehaines/gists{/gist_id}","starred_url":"https://api.github.com/users/imjoehaines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imjoehaines/subscriptions","organizations_url":"https://api.github.com/users/imjoehaines/orgs","repos_url":"https://api.github.com/users/imjoehaines/repos","events_url":"https://api.github.com/users/imjoehaines/events{/privacy}","received_events_url":"https://api.github.com/users/imjoehaines/received_events","type":"User","site_admin":false},"repo":{"id":71078268,"name":"schemer","full_name":"imjoehaines/schemer","owner":{"login":"imjoehaines","id":282732,"avatar_url":"https://avatars.githubusercontent.com/u/282732?v=3","gravatar_id":"","url":"https://api.github.com/users/imjoehaines","html_url":"https://github.com/imjoehaines","followers_url":"https://api.github.com/users/imjoehaines/followers","following_url":"https://api.github.com/users/imjoehaines/following{/other_user}","gists_url":"https://api.github.com/users/imjoehaines/gists{/gist_id}","starred_url":"https://api.github.com/users/imjoehaines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imjoehaines/subscriptions","organizations_url":"https://api.github.com/users/imjoehaines/orgs","repos_url":"https://api.github.com/users/imjoehaines/repos","events_url":"https://api.github.com/users/imjoehaines/events{/privacy}","received_events_url":"https://api.github.com/users/imjoehaines/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/imjoehaines/schemer","description":"A Joi-inspired interface for formatting and validating data structures in PHP.","fork":true,"url":"https://api.github.com/repos/imjoehaines/schemer","forks_url":"https://api.github.com/repos/imjoehaines/schemer/forks","keys_url":"https://api.github.com/repos/imjoehaines/schemer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/imjoehaines/schemer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/imjoehaines/schemer/teams","hooks_url":"https://api.github.com/repos/imjoehaines/schemer/hooks","issue_events_url":"https://api.github.com/repos/imjoehaines/schemer/issues/events{/number}","events_url":"https://api.github.com/repos/imjoehaines/schemer/events","assignees_url":"https://api.github.com/repos/imjoehaines/schemer/assignees{/user}","branches_url":"https://api.github.com/repos/imjoehaines/schemer/branches{/branch}","tags_url":"https://api.github.com/repos/imjoehaines/schemer/tags","blobs_url":"https://api.github.com/repos/imjoehaines/schemer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/imjoehaines/schemer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/imjoehaines/schemer/git/refs{/sha}","trees_url":"https://api.github.com/repos/imjoehaines/schemer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/imjoehaines/schemer/statuses/{sha}","languages_url":"https://api.github.com/repos/imjoehaines/schemer/languages","stargazers_url":"https://api.github.com/repos/imjoehaines/schemer/stargazers","contributors_url":"https://api.github.com/repos/imjoehaines/schemer/contributors","subscribers_url":"https://api.github.com/repos/imjoehaines/schemer/subscribers","subscription_url":"https://api.github.com/repos/imjoehaines/schemer/subscription","commits_url":"https://api.github.com/repos/imjoehaines/schemer/commits{/sha}","git_commits_url":"https://api.github.com/repos/imjoehaines/schemer/git/commits{/sha}","comments_url":"https://api.github.com/repos/imjoehaines/schemer/comments{/number}","issue_comment_url":"https://api.github.com/repos/imjoehaines/schemer/issues/comments{/number}","contents_url":"https://api.github.com/repos/imjoehaines/schemer/contents/{+path}","compare_url":"https://api.github.com/repos/imjoehaines/schemer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/imjoehaines/schemer/merges","archive_url":"https://api.github.com/repos/imjoehaines/schemer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/imjoehaines/schemer/downloads","issues_url":"https://api.github.com/repos/imjoehaines/schemer/issues{/number}","pulls_url":"https://api.github.com/repos/imjoehaines/schemer/pulls{/number}","milestones_url":"https://api.github.com/repos/imjoehaines/schemer/milestones{/number}","notifications_url":"https://api.github.com/repos/imjoehaines/schemer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/imjoehaines/schemer/labels{/name}","releases_url":"https://api.github.com/repos/imjoehaines/schemer/releases{/id}","deployments_url":"https://api.github.com/repos/imjoehaines/schemer/deployments","created_at":"2016-10-16T21:28:49Z","updated_at":"2016-10-16T21:28:50Z","pushed_at":"2016-10-26T18:52:31Z","git_url":"git://github.com/imjoehaines/schemer.git","ssh_url":"git@github.com:imjoehaines/schemer.git","clone_url":"https://github.com/imjoehaines/schemer.git","svn_url":"https://github.com/imjoehaines/schemer","homepage":"","size":51,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"i-am-tom:master","ref":"master","sha":"0b704639ddfeb87cf0f9b330a38cc99262f47bc9","user":{"login":"i-am-tom","id":6302310,"avatar_url":"https://avatars.githubusercontent.com/u/6302310?v=3","gravatar_id":"","url":"https://api.github.com/users/i-am-tom","html_url":"https://github.com/i-am-tom","followers_url":"https://api.github.com/users/i-am-tom/followers","following_url":"https://api.github.com/users/i-am-tom/following{/other_user}","gists_url":"https://api.github.com/users/i-am-tom/gists{/gist_id}","starred_url":"https://api.github.com/users/i-am-tom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i-am-tom/subscriptions","organizations_url":"https://api.github.com/users/i-am-tom/orgs","repos_url":"https://api.github.com/users/i-am-tom/repos","events_url":"https://api.github.com/users/i-am-tom/events{/privacy}","received_events_url":"https://api.github.com/users/i-am-tom/received_events","type":"User","site_admin":false},"repo":{"id":64166541,"name":"schemer","full_name":"i-am-tom/schemer","owner":{"login":"i-am-tom","id":6302310,"avatar_url":"https://avatars.githubusercontent.com/u/6302310?v=3","gravatar_id":"","url":"https://api.github.com/users/i-am-tom","html_url":"https://github.com/i-am-tom","followers_url":"https://api.github.com/users/i-am-tom/followers","following_url":"https://api.github.com/users/i-am-tom/following{/other_user}","gists_url":"https://api.github.com/users/i-am-tom/gists{/gist_id}","starred_url":"https://api.github.com/users/i-am-tom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i-am-tom/subscriptions","organizations_url":"https://api.github.com/users/i-am-tom/orgs","repos_url":"https://api.github.com/users/i-am-tom/repos","events_url":"https://api.github.com/users/i-am-tom/events{/privacy}","received_events_url":"https://api.github.com/users/i-am-tom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/i-am-tom/schemer","description":"A Joi-inspired interface for formatting and validating data structures in PHP.","fork":false,"url":"https://api.github.com/repos/i-am-tom/schemer","forks_url":"https://api.github.com/repos/i-am-tom/schemer/forks","keys_url":"https://api.github.com/repos/i-am-tom/schemer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/i-am-tom/schemer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/i-am-tom/schemer/teams","hooks_url":"https://api.github.com/repos/i-am-tom/schemer/hooks","issue_events_url":"https://api.github.com/repos/i-am-tom/schemer/issues/events{/number}","events_url":"https://api.github.com/repos/i-am-tom/schemer/events","assignees_url":"https://api.github.com/repos/i-am-tom/schemer/assignees{/user}","branches_url":"https://api.github.com/repos/i-am-tom/schemer/branches{/branch}","tags_url":"https://api.github.com/repos/i-am-tom/schemer/tags","blobs_url":"https://api.github.com/repos/i-am-tom/schemer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/i-am-tom/schemer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/i-am-tom/schemer/git/refs{/sha}","trees_url":"https://api.github.com/repos/i-am-tom/schemer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/i-am-tom/schemer/statuses/{sha}","languages_url":"https://api.github.com/repos/i-am-tom/schemer/languages","stargazers_url":"https://api.github.com/repos/i-am-tom/schemer/stargazers","contributors_url":"https://api.github.com/repos/i-am-tom/schemer/contributors","subscribers_url":"https://api.github.com/repos/i-am-tom/schemer/subscribers","subscription_url":"https://api.github.com/repos/i-am-tom/schemer/subscription","commits_url":"https://api.github.com/repos/i-am-tom/schemer/commits{/sha}","git_commits_url":"https://api.github.com/repos/i-am-tom/schemer/git/commits{/sha}","comments_url":"https://api.github.com/repos/i-am-tom/schemer/comments{/number}","issue_comment_url":"https://api.github.com/repos/i-am-tom/schemer/issues/comments{/number}","contents_url":"https://api.github.com/repos/i-am-tom/schemer/contents/{+path}","compare_url":"https://api.github.com/repos/i-am-tom/schemer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/i-am-tom/schemer/merges","archive_url":"https://api.github.com/repos/i-am-tom/schemer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/i-am-tom/schemer/downloads","issues_url":"https://api.github.com/repos/i-am-tom/schemer/issues{/number}","pulls_url":"https://api.github.com/repos/i-am-tom/schemer/pulls{/number}","milestones_url":"https://api.github.com/repos/i-am-tom/schemer/milestones{/number}","notifications_url":"https://api.github.com/repos/i-am-tom/schemer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/i-am-tom/schemer/labels{/name}","releases_url":"https://api.github.com/repos/i-am-tom/schemer/releases{/id}","deployments_url":"https://api.github.com/repos/i-am-tom/schemer/deployments","created_at":"2016-07-25T20:41:46Z","updated_at":"2016-10-25T20:49:28Z","pushed_at":"2016-10-26T18:55:52Z","git_url":"git://github.com/i-am-tom/schemer.git","ssh_url":"git@github.com:i-am-tom/schemer.git","clone_url":"https://github.com/i-am-tom/schemer.git","svn_url":"https://github.com/i-am-tom/schemer","homepage":"","size":94,"stargazers_count":10,"watchers_count":10,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/i-am-tom/schemer/pulls/12"},"html":{"href":"https://github.com/i-am-tom/schemer/pull/12"},"issue":{"href":"https://api.github.com/repos/i-am-tom/schemer/issues/12"},"comments":{"href":"https://api.github.com/repos/i-am-tom/schemer/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/i-am-tom/schemer/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/i-am-tom/schemer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/i-am-tom/schemer/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/i-am-tom/schemer/statuses/02a016d0af6ae065a6d803b2e31e8bc7ef710315"}}}}
{"actor":{"display_login":"imjoehaines"}}