[openstack-dev] Less of coding standard for i18n of LOG messages

Ying Chun Guo guoyingc at cn.ibm.com
Wed Nov 7 15:43:16 UTC 2012



Hi,

>From my observation, in the source codes, i18n of LOG messages (or strings)
are lack of consistency. There is no coding standard for the i18n of LOG
messages. Some LOG messages are wrapped with _(), some are not. Messages
wrapped with _() will be extracted into PO template and will be translated.
There is no rules to tell which kind of LOG messages should be translated
and which should not. It all happens randomly, depending on the programming
habits of developers. This is not good. We may need a wide discussion
within the community, get an agreement, make a coding standard for all
projects in OpenStack, and then change the codes to make them consistent.

First of all, there is an agreement within community that user-facing
string should be translated. As to LOG messages, there are arguments but no
consensus yet. One argument says the LOG messages are useful for
operators/administrators especially in the case of abnormal behavior and is
certainly accessible to users and therefore just like all user-facing text,
thus LOG messages should be translated. The opposing argument could say
that LOG is primarily useful for developers, developers can read English
LOG, and LOG in different languages will block the communication between
developers and users, thus LOG should not be translated.

Besides these arguments, there are some other questions we need to think
about. What if the same message is both logged AND thrown back to the user?
What about different log levels (EXCEPTION, ERROR, WARNING, AUDIT, INFO,
DEBUG)? I think DEBUG messages should never be translated as they are only
for developer consumption. What about the other levels?

Of course, before we make the decision, we also need to consider the
workload to change the existing codes in order to make them consistent.
Below statistic data are gotten by scanning the existing codes. You may
notice that LOG messages with _() are in the majority in the existing
codes. We may need to compare the workload to add _() to the minority with
the workload to remove _() from the majority.

----------STATISTIC DATA-----------------
Project name | Num of messages without _() | Num of messages with _()
Nova | 28 | 1988
Glance | 22 | 233
Keystone | 53 | 3
Quantum | 228 | 246
Cinder | 10 | 1525
----------------------------------------

Feel free to express your opinions. I'd love to hear feedback as much as
possible, especially people from Non-English speaking countries. You can
also help to do a survey within your customers, and let the community know
the result.

Thanks and regards
Daisy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20121107/21e495cf/attachment.html>


More information about the OpenStack-dev mailing list