views:

27

answers:

1

I've been working on data import functions for a library recently and I found myself doing this:

throw new InvalidDataException(string.Format("Line number {0} is {1} characters instead of {2}", lineNumber, line.Length, ValidLineLength))

That's useful debugging information to an English speaker. If it crops up in the Windows Event Log somewhere or gets displayed to a user they will have much more information than someone who doesn't understand the language.

What if the writer of the code doesn't use English (for whatever reason) and they create an error message like this?

throw new InvalidDataException("悲しい機能は悲しいです")

To everybody that uses the code and speaks the same language, that's great. For the rest of us... what does this mean when we log it?

What are your reasons for and against localising error messages?

A: 

In your exception statement, throw, new, InvalidDataException, string and Format are all in English. Any programmer using your library (or for that matter, coding in any common programming language) is going to need to speak English.

James Curran