45

When an error occurs in my .NET applications, i get an exception message in (in my case) swedish. This is useless for most purposes because.

  • The message is often just a poorly translated version of the original (english) exception message [1]

  • Exception messages are mosly used to diagnose problems, and that usually includes googling for the error messages. This means guessing or using a web service to find the original english message.

[1] I'm not joking. Example: "Calling assembly" in the context of a binding failure is completely obfuscated. It is translated to "called assembly" because of how english uses the same word for the one that is calling as for the one it is calling. Almost as if someone used a dictionary to translate it word by word.

So what I want: I want to be able to get english exception messages, consistently, on a non-english windows install (I do not want to change the thread culture of the application).

There is a similar question ( Exception messages in English? ) , but that is in the concept of logging. On that level I could just change the thread culture.

But I want the change to be global, and include "not my code" exceptions as well.

Is there any way this can be configured or "hacked" (e.g. by replacing resource files)? Am I the only person thinking that translating exception messages to begin with, is a horrible design flaw in .NET?

I'm sorry if this was part rant and part question.

Community
  • 1
  • 1
Anders Forsgren
  • 10,827
  • 4
  • 40
  • 77
  • How about not to show the exception message to end user directly? – deerchao Nov 07 '12 at 15:06
  • 12
    @deerchao He doesn't want to show them to the end user. He wants to be able to use them efficiently for debugging purpose. When looking for informations about an exception on the internet, it's better to have the original English text. In french, exceptions seems (often) better translated. But I lose time nevertheless to make my search engine query. – Eilistraee Nov 07 '12 at 15:15
  • Not sure if maybe this is helpful? http://stackoverflow.com/questions/2092298/force-exceptions-language-in-english – Prescott Nov 07 '12 at 15:17
  • 2
    @Eilistraee Oh, if that's the case, share my pain. My solution is to install English version of VS and .Net Framework, and an English OS is even better. – deerchao Nov 07 '12 at 15:18
  • 2
    You know this site :)? http://www.unlocalize.com/ – Jan Nov 07 '12 at 15:19
  • @deerchao It's exactly what I do. Especially since the different Silverlight frameworks (And SQL Server Express 2008) often failed their installations on non English systems (depending on the phase of the moon, the order of installation, the presence (or not) of other Framework in English versions). Now I work only on full English systems. (But there is hope, it seems to work a lot better with VS2012) – Eilistraee Nov 07 '12 at 15:23
  • @Jan Oh thanks. If it really works, it could be something very useful. – Eilistraee Nov 07 '12 at 15:24
  • I use unlocalize, but it feels like an unnecessary step if it can be avoided? Regarding windows language: have there been any improvements in Win8 regarding how you can change the language for windows? – Anders Forsgren Nov 07 '12 at 16:09
  • Check this out http://stackoverflow.com/questions/209133/c-sharp-exception-messages-in-english – Shelest Nov 07 '12 at 16:18
  • The exception message is for IT staff, the stack trace is for programmers. – Hans Passant Nov 07 '12 at 16:45
  • 1
    @HansPassant I don't understand, the stack trace just says *where* something went wrong, the message says *what* went wrong? I need both as a programmer (and I would certainly like it in english just as much if I was IT staff). But this is exactly the point: it needs to be possible to adapt to whoever sees them. During development on my own machine I am the only person reading them, and swedish messages (even to me as a native swedish speaker) are useless. – Anders Forsgren Nov 07 '12 at 17:53
  • @Shelest that was the question I mentioned in my post. It can help with logging, and "my own code", but not with a message ASP.NET spits out when I run someone elses web project for example. – Anders Forsgren Nov 07 '12 at 17:54
  • @AndersForsgren Okay. If i understand you, you want english error messages even from another dll, that your application hosting. Let's imagine that your application uses my dll. In this dll I created exceptions with strings in Russian. So how you think .net must translate them to you? I'm affraid but You want impossible. – Shelest Nov 08 '12 at 10:23
  • 1
    @Shelest no, I'd be happy with only the framework exception messages being in english. – Anders Forsgren Nov 08 '12 at 11:28

2 Answers2

4

Remove any .NET language packs. According to this ("The .NET Framework 4.5 Language Pack contains translated error messages and other UI text for languages other than English. If you don't install a language pack, this text is displayed in English"), it should be enough.

Expro
  • 143
  • 3
  • 5
    This relies on you having control of the client machine though doesn't it? I.e. It's using a [global solution to a local problem](http://blogs.msdn.com/b/oldnewthing/archive/2008/12/11/9193695.aspx?Redirected=true) (to quote @RaymondChen) – RB. Feb 12 '14 at 16:30
  • 3
    In Windows 10, this is impossible. Its added as a part of the OS... You would have to delete the language folders + all the satellite assemblies. And hope that the OS doesn't try to repair it. – Wolf5 Feb 05 '19 at 08:21
-1

On windows 10 you can do this but you need to change display language.

language setup

Then you need to set back your date time settings

date setup

You will have system in English but for most programmers that doesn't matter.

Palle Due
  • 5,929
  • 4
  • 17
  • 32
Icen
  • 441
  • 6
  • 14
  • This does not work for me. I have everything set to English (US), but still the errors appear in my native language. – Drak Aug 03 '21 at 11:40