products/CPSonFive.old

changeset 27:06c3cf7a9a27 regebro-five12

i18n fixes, and making CPS sites site managers.
author lregebro
date Wed, 14 Dec 2005 19:43:28 +0000
parents 33d2e20aedb3
children
files __init__.py overrides.zcml
diffstat 2 files changed, 7 insertions(+), 14 deletions(-) [+]
line diff
     1.1 --- a/__init__.py
     1.2 +++ b/__init__.py
     1.3 @@ -23,6 +23,7 @@
     1.4  """
     1.5  from types import StringTypes
     1.6  from zope.schema.interfaces import ITitledTokenizedTerm
     1.7 +from zope.i18nmessageid.messageid import MessageID
     1.8  
     1.9  # Zope3.0.0 doesn't translates dropdownboxes (that's a bug)
    1.10  def textForValue(self, term):
    1.11 @@ -33,21 +34,10 @@
    1.12      This can be overridden to support more complex term objects. The token
    1.13      is returned here since it's the only thing known to be a string, or
    1.14      str()able."""
    1.15 -    # XXX: This is how it should be once we start using Five 1.1, with i18n.
    1.16 -    # if ITitledTokenizedTerm.providedBy(term):
    1.17 -    #     return self.translate(term.title)
    1.18 -    # return self.translate(term.token)
    1.19 +    if ITitledTokenizedTerm.providedBy(term):
    1.20 +        return self.translate(term.title)
    1.21 +    return self.translate(term.token)
    1.22  
    1.23 -    # XXX: But with Five 1.0.x we need to call Localizer, and we also need to
    1.24 -    # make sure Localizer gets a string, and not a MessageID
    1.25 -    if ITitledTokenizedTerm.providedBy(term):
    1.26 -        message = term.title
    1.27 -    else:
    1.28 -        message = term.token
    1.29 -
    1.30 -    if type(message) not in StringTypes:
    1.31 -        message = str(message)
    1.32 -    return self.context.context.Localizer.default(message)
    1.33  
    1.34  from zope.i18n.interfaces import IUserPreferredCharsets
    1.35  from zope.interface import implements
     2.1 --- a/overrides.zcml
     2.2 +++ b/overrides.zcml
     2.3 @@ -17,4 +17,7 @@
     2.4        factory="Products.Five.i18n.LocalizerLanguages"
     2.5        />
     2.6  
     2.7 +  <five:localsite class="Products.CPSDefault.Portal.CPSDefaultSite" />
     2.8 +  <five:traversable class="Products.CPSDefault.Portal.CPSDefaultSite" />
     2.9 +
    2.10  </configure>