Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should Exception Messages be Globalized

I'm working on a project and I'm just starting to do all the work necessary to globalize the application. One thing that comes up quite often is whether to globalize the exception messages, but ensuring that string.Format uses CultureInfo.CurrentCulture instead of CultureInfo.InvariantCulture. Additionally this would mean that exception messages would be stored in resource files that can be marked as culture-specific.

So the question is, should exception messages be globalized or should be be left in either the InvariantCulture or the author's country; in my case en-US.

like image 395
Orion Adrian Avatar asked Jan 23 '09 20:01

Orion Adrian


2 Answers

Exception messages should rarely be displayed directly to the user. You need to think of the consumer for each string. Obviously pieces of text in the user interface need internationalizing, but if an exception message is only going to be seen by support (or is going to be visible to the user and then emailed to support when they click a button) then where's the benefit of translating it?

If you go too far, you could not only waste time and effort (and i18n can take a lot of effort) but you'll also make your support life harder as well. You really don't want to have to read log files written in a foreign language and translate them back to your native tongue.

It makes sense for Microsoft to internationalize their exception messages, because they will be read by developers from all over the world - but unless you're multinational with developers in multiple countries who don't share a common language, I wouldn't translate message which are really meant for dev/support.

like image 88
Jon Skeet Avatar answered Oct 04 '22 14:10

Jon Skeet


typically, I don't.

Globalize strings that may be seen by a user, and you don't let your exception messages percolate up to the UI, right?

Right? :)

like image 32
Greg D Avatar answered Oct 04 '22 13:10

Greg D