views:

192

answers:

4

With applications now being developed for users of many nationalities, localization is very important. I read on firefox's web site it is available in 70 languages. This increases their potential market dramatically.

During a recent user acceptance testing session for my project, a bug was found. The exception was:

"String was not recognized as a valid Boolean"

As far as the bug went, we were trying to do a bool.Parse() with an empty string. An interesting note was appended that "recognized" was spelt incorrectly as well. To give some context, users are in Australia, where "recognise" is the correct spelling. Unfortunately this exception was not generated by us, so changing it would require re-mapping the exception!

Has anybody had any experience with similar situations? Are there ways to localize the .net exceptions?

I have undergone Microsoft certification exams and a lot of content was related to the importance of localisation and culture, so I thought it reasonable to expect the .NET framework to consider this too.

+1  A: 

Well I'll get started.

I found this article which gives a reason why exceptions might not want to be localised. For public API's or libraries, having exactly the same exception allows users to google the exception and find results and hopefully a solution. Translating would make this more difficult.
I believe if an API can give a numerical error value this would work around the problem and allow an understood exception to be thrown.

Russell
+3  A: 

I'll follow up @Russell with the fact that no error messages themselves should be localised, and should be given a number. However this is because a number provides no information to someone attempting to break into your software to exploit it. You would want to localise a message to contact support but not the error code/stack trace.

If you give an error Type 13251 additional info abc234, please contact support, someone looking to exploit a buffer overflow or sql injection isn't going to get feedback which they can use to their advantage.

Spence
I totally agree, the exception shown to the user should be a standard "problem occurred, contact admin", and the complete message/stack trace logged internally. Perhaps even an ID given to the user to reference the issue internally as well.
Russell
You can explicitly number pathways through your exception handling code so that if something does need to bubble you know where it came from.
Spence
+1  A: 

Well, exception messages are generally NOT supposed to be fed to the end-users though there might be some exceptions (pun not intended :P).

o.k.w
That's true, however there are exceptions. In my case, a web application, if the exception occurred between client and the ASP .net server (IIS or WAS), it could be thrown without ever reaching my code.
Russell
@Russell, is that a situation that the Custom Error page does not handle?
Greg
@Greg, good point. However the custom error pages may not be able to display the error message with the reference to the internally logged error?
Russell
That sounds possible, you'd have to try and see. :/
Greg
+1  A: 

Strings including exception messages from the .NET Framework are localized provided you have installed the appropriate Language Pack(s) - these can be downloaded here.

However I don't think there are language packs for UK or Aussie English, so we'll have to put up with US English.

Joe
Well the american way is right isn't it? They've only recently localised the MSDN into UK english. We still don't have Aussie english though. The .Net 4.0 framework is absolutely bonza! IF you want to use covariance and contravariance in your code, no worries!
Spence
Yeah the en-AU culture isn't quite there yet lol, for professional applications generally the UK English is adequate :) (After all we Aussies are decendents of British convicts :P )
Russell
"decendents of British convicts" - and the Irish???
Joe