本地化生成的系统状态信息 [英] Localizing system generated status messages

查看:198
本文介绍了本地化生成的系统状态信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作在.NET环境中,其中系统偶尔产生日志条目为客户。消息被附加到其可以在以后的时间进行审查客户日志。

I am working in a .NET environment where the system occasionally generates log entries for a customer. Messages are then appended to a customer log which can be reviewed at a later time.

例如,如果客户正在订阅到一个新的服务,或一客户有一个失败尝试支付,这些消息被附加到顾客日志

For example, if a customer is subscribing to a new service, or a customer has a failed payment attempt, these messages gets appended to the customer log.

目前,所有的消息都很难codeD插入code,如客户未能完成支付的XX。

At the moment, all messages are hardcoded into the code, e.g "Customer failed to finish payment of XX".

现在的问题是需要这些信息在一个巧妙的方法来进行本地化,这样,当一个英语用户点评客户日志,他得到的英文消息,当一个外国用户评论日志,他得到他们他的语言。

The problem is now that these messages need to be localized in a smart way, such that when a English user reviews the customer log, he gets the messages in English, and when a foreign user reviews the log, he gets them in his language.

什么是处理这种情况的最好方法是什么?

What would be the best way to handle this scenario?

推荐答案

  • 请事件标识符,而不是消息。
  • 在捕捉事件与事件一起标识特定的数据。
  • 当用户查看日志,定位基于所述唯一标识符的事件消息。

你会碰到的问题是,如果你试图插入在对话的方式动态数据到消息。例如,如果你有写未找到信息与一个消息发现与发现X封邮件是有问题的 - 英语,我们有不同的多个零,一个,一个以上的...但它不一定喜欢,在其他语言。比如像数字或日期是的String.Format形式插入问题较少,但你不想让在试图动态生成以本地化方式真实的语言业务。

The problem you'll run into is if you try to insert dynamic data into the messages in a conversational fashion. For example, if you have to write "No messages found" vs. "One message found" vs. "X messages found" is problematic - in English we have different pluralities for zero, one, and more than one... but it's not necessarily like that in other languages. Things like numbers or dates are less problematic to insert in String.Format form, but you don't want to get in the business of trying to dynamically generate real language in a localized fashion.

我建议以下的图案很像Windows事件日志,你输出的事件ID,基于事件ID的本地化的消息,然后获取一定的场在这里您可以本地化的字段名称和该领域的显示格式,如金额:$ 2.00或什么的。这未必是prettiest的路要走,但除非你有一个全职的语言学家致力于这一点,你打算占每种语言的所有细微差别不大,我会踢去用一个简单的日志输出格式。

I'd recommend following a pattern a lot like the Windows Event Log where you output an event ID, a localized message based on the event ID, and then capturing certain "fields" where you'll localize the field name and the display format of the field, like "Amount: $2.00" or whatever. It may not be the prettiest way to go, but unless you've got a full-time linguist dedicated to this and you intend on accounting for all the little nuances of every language, I'd punt and go with a simpler log output format.

在你给出的例子,你会分开日志消息从数据,如:

In your given example, you'd separate the log message from the data, like:

客户未能完成付款。
金额:XX

Customer failed to finish payment.
Amount: XX

您会记录一个消息ID,如13579,当客户没有完成付款可能是该事件的唯一ID。最后,你可以在值存储为一个单独的字段。

You'd log a message ID, like "13579" might be the unique ID for the event when a customer fails to finish a payment. Finally, you could store the value as a separate field.

你如何计算出有多少个字段分配给一个事件或如何存储数据是...好,锻炼最好留给读者。

How you go about figuring out how many fields to allocate to an event or how to store the data is... well, an exercise best left to the reader.

这篇关于本地化生成的系统状态信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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