Ignore:
Timestamp:
25 Feb 2012, 10:21:54 (13 years ago)
Author:
Henrik Bettermann
Message:

Internationalize ReSTDisplayWidget which now returns a dictionary with different tranlations.

Different languages must be separated by <<xy>> whereas
xy is the language code. Text parts without correct leading
language separator - usually the first part has no language
descriptor - are interpreted as texts in the portal's language.
The latter can be configured in waeup.srp.utils.utils.SIRPUtils.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r7700 r7702  
    292292    @property
    293293    def frontpage(self):
    294         return self.context['configuration'].frontpage_html
     294        portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     295        lang = self.request.cookies.get('sirp.language', portal_language)
     296        return self.context['configuration'].frontpage_dict.get(lang,'')
    295297
    296298class AdministrationPage(SIRPPage):
     
    623625        _('Add session configuration'),
    624626        _('Remove selected')]
    625 
    626     form_fields = grok.AutoFields(IConfigurationContainer)
    627     form_fields['frontpage_html'].for_display = True
     627    form_fields = grok.AutoFields(IConfigurationContainer).omit('frontpage_dict')
    628628
    629629    def update(self):
     
    638638        return super(ConfigurationContainerManageFormPage, self).update()
    639639
    640     def frontpage(self):
     640    def _frontpage(self):
    641641        view = ConfigurationContainerDisplayFormPage(
    642642            self.context,self.request)
     
    647647    def save(self, **data):
    648648        self.applyData(self.context, **data)
    649         self.context.frontpage_html = self.frontpage()
     649        self.context.frontpage_dict = self._frontpage()
    650650        self.flash(_('Settings have been saved.'))
    651651        return
Note: See TracChangeset for help on using the changeset viewer.