-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Add translations for exception reasons #206
RFC: Add translations for exception reasons #206
Conversation
@@ -14,5 +14,8 @@ | |||
*/ | |||
interface ResetPasswordExceptionInterface extends \Throwable | |||
{ | |||
public const MESSAGE_PROBLEM_VALIDATE = 'There was a problem validating your password reset request'; | |||
public const MESSAGE_PROBLEM_HANDLE = 'There was a problem handling your password reset request'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those strings are hardcode in Maker - probably we could migrate them in this bundle as well and then just reuse these constants in Maker, see https://github.com/symfony/maker-bundle/blob/085358c107a7047b4889455d7518d0dbf55169f1/src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php#L160
…into translate-exceptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks @bocharsky-bw
Related PR to Maker bundle created: symfony/maker-bundle#1059 |
…ded by ResetPasswordBundle (bocharsky-bw) This PR was squashed before being merged into the 1.0-dev branch. Discussion ---------- [make:reset-password] Translate exception reasons provided by ResetPasswordBundle If there's `Symfony\Contracts\Translation\TranslatorInterface` service available in the project - Maker will generate a slightly different controller's code to inject translator service and translate exception reasons out of the box. Available after: SymfonyCasts/reset-password-bundle#206 Commits ------- b771178 [make:reset-password] Translate exception reasons provided by ResetPasswordBundle
Closes #202
The next step - I'll create a PR in Maker bundle to wrap reasons with
Translator::trans()
- then all exception messages in this bundle will be automatically translated. The remaining step - wait for more translation contributions.Basically, I explained a workaround here which can be avoided with this PR: #202 (comment)