如何完全避免本地化.NET异常消息 [英] How to completely avoid localized .NET exception messages

查看:31
本文介绍了如何完全避免本地化.NET异常消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.NET应用程序中发生错误时,我收到瑞典文(以我为例)的异常消息.对于大多数目的来说,这是没有用的,因为.

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.

  • 该消息通常只是原始(英语)异常消息[1]的翻译不正确的版本.

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

异常消息通常用于诊断问题,并且通常包括对错误消息进行谷歌搜索.这意味着猜测或使用Web服务来查找原始英文消息.

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]我不是在开玩笑.示例:绑定失败的上下文中的调用程序集"被完全混淆.之所以将其翻译为集会",是因为英语在呼叫时使用的单词与呼叫时使用的单词相同.就像有人用字典逐字翻译它一样.

[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.

所以我想要什么:我希望能够在非英语的Windows安装上始终获得英语异常消息(我不想要更改应用程序的线程区域性).

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.

是否可以通过任何方式对此进行配置或黑客入侵"(例如,通过替换资源文件)?我是唯一认为翻译异常消息开始的人吗,.NET中的可怕设计缺陷吗?

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.

推荐答案

删除任何.NET语言包.根据(".NET Framework 4.5语言包包含翻译后的错误消息和英语以外的其他语言的其他UI文本.如果您未安装语言包,则该文本以英语显示"),就足够了.

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.

这篇关于如何完全避免本地化.NET异常消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆