[Zope3-Users] Problem with zc.table content internationalization

Thierry Florac thierry.florac at onf.fr
Tue Jan 30 06:42:18 EST 2007


  Hi,

I currently have a little problem to translate contents displayed in a
zc.table component.
Here is an extract of my Python code :

        
        from onf import _
        
        DRAFT          =  0  # New document
        PROPOSED       =  1  # Publication request
        CANCELED       =  2  # Publication request canceled
        REFUSED        =  3  # Publication request refused
        PUBLISHED      =  4  # Publication approved
        
        StateLabels = { 
            DRAFT     : _("status-draft","Draft"),
            PROPOSED  : _("status-proposed","Publication request"),
            CANCELED  : _("status-canceled","Canceled publication
        request"),
            REFUSED   : _("status-refused","Refused publication
        request"),
            PUBLISHED : _("status-published","Published")
        }
        
        class EventManagerSearchForm(BaseForm):
            ...
            columns = (...
              SortableColumn(_('status','Status'),
                lambda c,f:
        StateLabels.get(IWorkflowState(c).getState())),
                       ...)
        
            @Lazy
            def formatter(self):
                return Formatter(self.context, self.request,
                                 self.values(),columns=self.columns)


ZPT is as simple :

        <html i18n:domain="onf">
            ...
            <table tal:replace="structure view/formatter" />
            ...
        </html>


My problem is that the "StateLabels" are translated correctly in several
templates, but not when used inside this table (I can only see the
"status-..." translation key in generated output).
So any help or advise would be very helpful...

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : thierry.florac at onf.fr
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85



More information about the Zope3-users mailing list