针对开发人员的异常消息是否应该本地化? [英] Should exception messages that are targeted to the developer be localized?

查看:20
本文介绍了针对开发人员的异常消息是否应该本地化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是显示开发人员未正确使用 API 的异常消息.例如,错误地将 null 传递给方法.因此,开发人员第一次运行不正确的代码时将获得的异常类型.不应向系统用户显示的异常消息类型.

I am referring to exception messages that show the developer is incorrectly using an API. For example incorrectly passing a null to method. So the type of exception that the developer will get the first time they have run their incorrect code. The type of exception message that should never get to be displayed to the user of a system.

这与这样一种理论有关,即既然编程语言是英语,那么程序员已经对英语有所了解.或者至少足以破译异常消息.

This is kind of related to the theory that since the programming language is in English then the programmer already has an understanding of English. Or at least enough to decipher an exception message.

http://www.codinghorror.com/blog/archives/001248.html(请不要在这里讨论这个理论)

http://www.codinghorror.com/blog/archives/001248.html (please no discussion of this theory here)

是的,我知道 .net 框架遵循本地化一切"的方法.

And yes I know that the .net framework follows the "localize everything" approach.

推荐答案

您的问题可以改写为是否所有开发人员都应该收到相同的错误消息,以便他们可以通过 Google 搜索?";)

Your question can be rephrased as "should all developers get the same error message so that they can Google it?" ;)

答案是肯定的.

翻译的意思是

  • 该消息不再与编写 API 的人相同.它可能具有相同的含义,或者可能在翻译中丢失了一些东西.它可能翻译得很糟糕,在某些情况下可能完全不可读.
  • 阅读它的人不能简单地将错误输入 Google 并查看其他收到此错误的人做了什么.因为其他人都用不同的语言犯了同样的错误.

关于 .NET 的本地化一切"方法,这太可怕了.我已经无数次被它绊倒了,特别是因为如果它无法找到本地化的资源,它不会给你简单的英文版本.相反,它会给你一个无法定位资源"的错误,有效地丢弃了实际的错误信息.

About .NET's "localize everything" approach, it is horrible. I've been tripped up by it countless times, especially because if it is unable to find the localized resource, it does not give you the plain English version. It gives you a "Could not locate resource" error instead, effectively throwing away the actual error information.

这篇关于针对开发人员的异常消息是否应该本地化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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