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

2007-01-30 Thread Thierry Florac
  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 : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


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

2007-01-30 Thread Fred Drake

On 1/30/07, Thierry Florac [EMAIL PROTECTED] wrote:

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).


You'll need to use a SortableColumn subclass that performs the
translation in the renderCell() method.


 -Fred

--
Fred L. Drake, Jr.fdrake at gmail.com
Every sin is the result of a collaboration. --Lucius Annaeus Seneca
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users