{"action":"created","issue":{"url":"https://api.github.com/repos/octobercms/october/issues/2106","repository_url":"https://api.github.com/repos/octobercms/october","labels_url":"https://api.github.com/repos/octobercms/october/issues/2106/labels{/name}","comments_url":"https://api.github.com/repos/octobercms/october/issues/2106/comments","events_url":"https://api.github.com/repos/octobercms/october/issues/2106/events","html_url":"https://github.com/octobercms/october/issues/2106","id":159039333,"number":2106,"title":"Translate AuthException messages from October\\Rain\\Auth\\Manager","user":{"login":"jBOKA","id":8607110,"avatar_url":"https://avatars.githubusercontent.com/u/8607110?v=3","gravatar_id":"","url":"https://api.github.com/users/jBOKA","html_url":"https://github.com/jBOKA","followers_url":"https://api.github.com/users/jBOKA/followers","following_url":"https://api.github.com/users/jBOKA/following{/other_user}","gists_url":"https://api.github.com/users/jBOKA/gists{/gist_id}","starred_url":"https://api.github.com/users/jBOKA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jBOKA/subscriptions","organizations_url":"https://api.github.com/users/jBOKA/orgs","repos_url":"https://api.github.com/users/jBOKA/repos","events_url":"https://api.github.com/users/jBOKA/events{/privacy}","received_events_url":"https://api.github.com/users/jBOKA/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/octobercms/october/labels/third%20party","name":"third party","color":"cccccc"},{"url":"https://api.github.com/repos/octobercms/october/labels/Type:%20Question","name":"Type: Question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-07T22:27:21Z","updated_at":"2016-06-08T08:31:45Z","closed_at":null,"body":"What would be the best approach to translate authentication messages like this one\r\nhttps://github.com/octobercms/library/blob/master/src/Auth/Manager.php#L391\r\n\r\nI started customizing the login from the RainLab.User plugin by overriding the components, which worked out pretty well. Then I realized, the Auth facade is a class from the october rain library. Do I have to override the whole facade to translate?\r\nOne language would be enough, no need to internationalize so far. Why are these frontend related strings so deep in the core?"},"comment":{"url":"https://api.github.com/repos/octobercms/october/issues/comments/224523752","html_url":"https://github.com/octobercms/october/issues/2106#issuecomment-224523752","issue_url":"https://api.github.com/repos/octobercms/october/issues/2106","id":224523752,"user":{"login":"jBOKA","id":8607110,"avatar_url":"https://avatars.githubusercontent.com/u/8607110?v=3","gravatar_id":"","url":"https://api.github.com/users/jBOKA","html_url":"https://github.com/jBOKA","followers_url":"https://api.github.com/users/jBOKA/followers","following_url":"https://api.github.com/users/jBOKA/following{/other_user}","gists_url":"https://api.github.com/users/jBOKA/gists{/gist_id}","starred_url":"https://api.github.com/users/jBOKA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jBOKA/subscriptions","organizations_url":"https://api.github.com/users/jBOKA/orgs","repos_url":"https://api.github.com/users/jBOKA/repos","events_url":"https://api.github.com/users/jBOKA/events{/privacy}","received_events_url":"https://api.github.com/users/jBOKA/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T08:31:45Z","updated_at":"2016-06-08T08:31:45Z","body":"I now did it like this in my mod of `RainLab\\User\\Components\\Account` in function `onSignin` for example\r\n```PHP\r\ntry {\r\n    $user = Auth::authenticate($credentials, true);\r\n} catch (\\October\\Rain\\Auth\\AuthException $e) {\r\n    $authMessage = $e->getMessage();\r\n    // for error messages see October\\Rain\\Auth\\Manager\r\n    if (strrpos($authMessage,'hashed credential') !== false) {\r\n        $message = 'Translated string for wrong pw.';\r\n    } elseif (strrpos($authMessage,'user was not found') !== false) {\r\n        $message = 'Translated string for user not found';\r\n    } elseif (strrpos($authMessage,'not activated') !== false) {\r\n        $message = 'Translated string for inactive account';\r\n    } else {\r\n        throw $e;\r\n    }\r\n    // now throw custom exception or return something to ajax request\r\n}\r\n```\r\n\r\nBut matching against these message snippets doesn't seem right... maybe the `October\\Rain\\Auth\\Manager` could return some code like `user_not_found` or how do you usually hand over additional information in an exception? Create custom exceptions for each error?"}}
{"actor":{"display_login":"jBOKA"}}