← Back to team overview

openstack team mailing list archive

Re: I18n issue for OpenStack

 

+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@xxxxxxxxxx             District, Beijing, P.R.C.100193       
 Notes ID: Hua ZZ Zhang/China/IBM                                            
 Tel: 86-10-82450483                                                         
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                             





                                                                           
             Joshua Harlow                                                 
             <harlowja@yahoo-i                                             
             nc.com>                                                    To 
                                       Hua ZZ Zhang/China/IBM@IBMCN,       
             2012-04-13 01:33          Thierry Carrez                      
                                       <thierry@xxxxxxxxxxxxx>             
                                                                        cc 
                                       "openstack-bounces                  
                                       +zhuadl=cn.ibm.com@lists.launchpad. 
                                       net"	<openstack-bounces            
                                       +zhuadl=cn.ibm.com@lists.launchpad. 
                                       net>, openstack                     
                                       <openstack@xxxxxxxxxxxxxxxxxxx>     
                                                                   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@xxxxxxxxxx> 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@xxxxxxxxxx
      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@xxxxxxxxxxxxx>
                              Sent by: openstack-bounces
                              +zhuadl=cn.ibm.com@xxxxxxxxxxxxxxxxxxx
                              2012-04-12 16:47



                                                                         To



      openstack@xxxxxxxxxxxxxxxxxxx



                                                                         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.

GIF image

GIF image

GIF image

GIF image


References