Translation of Exceptions

25 days ago

dangquan09
Member | 1
+
0
-

Hi,

has anyone a solution for translate the thrown exeptions from Nette without changing the main classes.

For examle the SimpleAuthenticator Class is throwing a

AuthenticationException(‘Invalid password.’, self::INVALID_CREDENTIAL);

or

AuthenticationException(“User ‘$username’ not found.”, self::IDENTITY_NOT_FOUND);

I use Kdyby/Translation, but i find no solution für translate this Exception text to german with this extension.

regards Frank

25 days ago

David Matějka
Moderator | 5936
+
+2
-

hi,
you should not translate exceptions. instead, you should create end-user message based on exception type and its code.