如果异常消息是全球化 [英] Should Exception Messages be Globalized

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

问题描述

我工作的一个项目,我刚开始做所有必要的工作,以全球化的应用程序。那个经常出现的一件事是,是否全球化异常消息,但要确保使用的String.format的CultureInfo.CurrentCulture代替CultureInfo.InvariantCulture。此外,这将意味着异常信息将被存储在一个可以被标记为文化特有的资源文件。

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.

所以现在的问题是,应该异常消息是全球化还是应该留在无论是InvariantCulture的或作者的国家;在我的情况EN-US。

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.

推荐答案

异常消息应该很少直接显示给用户。你需要考虑消费者的每一个字符串。在用户界面上的文字显然件需要国际化的,但如果一个例外消息的只有的将是由支持待观察(或将是可见的用户,然后通过电子邮件发送给支持,当他们点击按钮),那么哪来的翻译呢?

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?

如果你走太远,你可以不仅浪费时间和精力(和国际化可以采取的大量<受益功夫/ em>的),但你还可以让你的技术支持生命更难为好。你真的不希望有读取日志写在一个外国语言文件,并将其转换回母语。

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.

这是有道理的,微软国际化的他们的异常信息,因为它们会被的开发<读/ em>的来自世界各地的 - 但除非你是跨国公司与开发商在多个国家谁不都有一个共同的语言,我不会转化消息这是真的意味着开发/支持。

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.

这篇关于如果异常消息是全球化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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