[Openstack] I18n issue for OpenStack

Hua ZZ Zhang zhuadl at cn.ibm.com
Mon Apr 16 10:13:05 UTC 2012


+1

The exception is used for flow control when it happens. yes, that's right
but not completed.:-)
When you look into the current design of exceptions such as nova
exceptions, they include message content which is meaningful and useful.
Apparently, the exception is not only used for flow control, but also for
showing user why this could happen. It is not bad smell for code or
conflict with MVC design pattern, I think. Add another separate layer is
complex and not necessary. The gettext tookit allow the message to be
translated or untranslated. It depends on the user requirements on this
that we can't ignore.

nova/nova/exception.py:
...
class DecryptionFailure(NovaException):
    message = _("Failed to decrypt text")


class ImagePaginationFailed(NovaException):
    message = _("Failed to paginate through images from image service")


class VirtualInterfaceCreateException(NovaException):
    message = _("Virtual Interface creation failed")


class VirtualInterfaceMacAddressException(NovaException):
    message = _("5 attempts to create virtual interface"
                "with unique mac address failed")


class GlanceConnectionFailed(NovaException):
    message = _("Connection to glance failed") + ": %(reason)s"


class MelangeConnectionFailed(NovaException):
    message = _("Connection to melange failed") + ": %(reason)s"
...



Best Regards,

                                                                             
 Edward Zhang(ÕÅ»ª)                    µØÖ·:±±¾©Êк£µíÇø¶«±±ÍúÎ÷·8ºÅ Öйشå 
 Staff Software Engineer               Èí¼þÔ°28ºÅÂ¥ »·Óî´óÏÃ3²ã Óʱࣺ100193 
 Travel&Transportation Standards       Address: 3F Ring, Building 28         
 Emerging Technology Institute(ETI)    Zhongguancun Software Park, 8         
 IBM China Software Development Lab    Dongbeiwang West Road, Haidian        
 e-mail: zhuadl at cn.ibm.com             District, Beijing, P.R.C.100193       
 Notes ID: Hua ZZ Zhang/China/IBM                                            
 Tel: 86-10-82450483                                                         
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             





                                                                           
             Joshua Harlow                                                 
             <harlowja at yahoo-i                                             
             nc.com>                                                    To 
                                       Hua ZZ Zhang/China/IBM at IBMCN,       
             2012-04-13 01:33          Thierry Carrez                      
                                       <thierry at openstack.org>             
                                                                        cc 
                                       "openstack-bounces                  
                                       +zhuadl=cn.ibm.com at lists.launchpad. 
                                       net"	<openstack-bounces            
                                       +zhuadl=cn.ibm.com at lists.launchpad. 
                                       net>, openstack                     
                                       <openstack at lists.launchpad.net>     
                                                                   Subject 
                                       Re: [Openstack] I18n issue for      
                                       OpenStack                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




So u have just touched on another issue,

I would still say that exception messages should not be translated (+1),
haha.

If this is needed, then there is something wrong with the code and how
exceptions are used instead (ie the bad code smell). Exceptions should be
meant for error control flow, what they were designed for, not for user
facing messages. I think it is more common to have a layer that translates
exceptions into meaningful localized messages, but there needs to be a
separation between exceptions and there localized messages (they should not
be combined). This is a common thing afaik, its called separation of model
and view, aka, mvc, (think of the exceptions as a model/controller(?), if
the messages ¨C the view are intertwined that seems broke).

This is common with a lot of other parts of openstack as well, ec2
formatting/response creation should be separated from nova logic (ec2
should be a view, which it mostly is right now) and so on...

On 4/12/12 4:27 AM, "Hua ZZ Zhang" <zhuadl at cn.ibm.com> wrote:

      My cents:

      Apache HTTP is not so equivelant to OpenStack here. Generally it
      doesn't care about the application errors or exceptions thrown by web
      applications. In openstack, exceptions have been defined in nova,
      horizon, keystone etc. The messages of these exceptions are important
      for different users to understand what has happened. These messages
      always need to be localized, returned and displayed on user
      interface, not just be logged in backend system. It is very common
      practice for a global software project.

      Sean Dague wrote:
      > If we want to think about OpenStack as a basic building block like
      > Apache, i18n is critical. Otherwise there are regions that won't
      adopt
      > it solely because of a lack of i18n.

      Note that Apache HTTPd, for instance, does not seem to
      internationalize
      its error messages. Only the (enduser-facing) HTML pages it gives
      back
      in response to invalid requests are.



      Best Regards,

      Edward Zhang(́Ȼ)
      Staff Software Engineer
      Travel&Transportation Standards
      Emerging Technology Institute(ETI)
      IBM China Software Development Lab
      e-mail: zhuadl at cn.ibm.com
      Notes ID: Hua ZZ Zhang/China/IBM
      Tel: 86-10-82450483µØÖ·:±±¾©Êк£µíÇø¶«±±ÍúÎ÷·8ºÅ ÖйشåÈí¼þÔ°28ºÅÂ¥
      »·Óî´óÏÃ3²ã Óʱࣺ100193
      Address: 3F Ring, Building 28 Zhongguancun Software Park, 8
      Dongbeiwang West Road, Haidian District, Beijing, P.R.C.100193



      Thierry Carrez ---2012-04-12 16:51:59---Sean Dague wrote:

                              Thierry Carrez <thierry at openstack.org>
                              Sent by: openstack-bounces
                              +zhuadl=cn.ibm.com at lists.launchpad.net
                              2012-04-12 16:47



                                                                         To



      openstack at lists.launchpad.net



                                                                         cc






                                                                    Subject



      Re: [Openstack] I18n issue for OpenStack

      Sean Dague wrote:
      > If we want to think about OpenStack as a basic building block like
      > Apache, i18n is critical. Otherwise there are regions that won't
      adopt
      > it solely because of a lack of i18n.

      Note that Apache HTTPd, for instance, does not seem to
      internationalize
      its error messages. Only the (enduser-facing) HTML pages it gives
      back
      in response to invalid requests are.

      > Is there a metric on the completeness so far? Something automated
      that
      > could be a jenkins coverage kind of test?

      Oddly enough, it's not a question of completeness of translations.
      Piggybacking on the awesome Launchpad Translations community always
      gave
      us great coverage. It's more a code support and CI integration issue.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120416/02bb93ad/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 33817450.gif
Type: image/gif
Size: 1279 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120416/02bb93ad/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120416/02bb93ad/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120416/02bb93ad/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic15417.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120416/02bb93ad/attachment-0003.gif>


More information about the Openstack mailing list