Localizing Exception Messages

Posts   
 
    
hylegoz
User
Posts: 10
Joined: 11-Jul-2008
# Posted on: 18-Jul-2008 09:36:03   

Hi,

Can we localize the LLBLGen Pro exception messages? Our program will contain the runtime activated multilanguage support. We have to store our exception messages on database or XML file.

Is this possible?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39866
Joined: 17-Aug-2003
# Posted on: 18-Jul-2008 11:19:42   

Depends on which exception messages you're talking about. If you mean the query execution exceptions etc., no these are hardcoded, the reason is below. If you mean the validation exception messages, yes you can, though you need to validate the values yourself. Could you elaborate a bit which exceptions you want to localize?

The reason most exceptions are hardcoded english texts is that they shouldn't be presented to end-users. The exceptions are signals of program bugs / situations the end user can't do anything about, e.g. a concurrency conflict, FK violations etc. These exceptions shouldn't be presented to the end user, the user should be presented a helpful error message and guidance how to solve it, IF the user can even help. If the user can't do a thing about it, the user shouldn't see any exception: the application should solve it for the user.

Frans Bouma | Lead developer LLBLGen Pro
hylegoz
User
Posts: 10
Joined: 11-Jul-2008
# Posted on: 21-Jul-2008 10:06:06   

Thank you for attention.

I mean validation messages with "exception messages". We can handle the ORM*Exceptions with try-catch blocks or AOP techniques. But here is the problem:

We bind our entities to the Developer Express XtraGrid component. The grid submits cell change to the entity, the entity validates the field and throws an exception like this: "Parameter value length must be lesser than 50." (I cannot remember the exact message.)

Grid catches the exception and shows the exception message to user in a tooltipbox. I can't touch this process for including it in multilanguage using AOP and I don't want to modify the template file.

You said, I can handle the validation classes, but isn't it too hard to handle for 280 entities? Can I apply the same validator class to all of the entities?

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 21-Jul-2008 10:14:50   

Can I apply the same validator class to all of the entities?

Yes this can be easily done using Dynamic Injection.