Products.CMFCore.interfaces.ICatalogTool"
provides="Products.CMFCore.interfaces.IIndexableObject"
factory=".catalog_adapters.PlinnIndexableObjectWrapper" />
+ <adapter
+ for="zope.publisher.interfaces.http.IHTTPRequest"
+ provides="zope.i18n.interfaces.IUserPreferredLanguages"
+ factory=".userlanguages.AuthenticatedUserLanguages"
+ />
+
</configure>
<input type="text" name="email" value="" tal:attributes="value python:member.getProperty('email', None)" />
</td>
</tr>
+ <tr>
+ <th i18n:translate="">Preferred languages</th>
+ <td>
+ <input type="text" name="preferred_languages:tokens"
+ tal:attributes="value python:' '.join(member.getProperty('preferred_languages', []))"/>
+ <dl class="FieldHelp">
+ <dd i18n:translate="">Please enter language codes separated by spaces.</dd>
+ </dl>
+ </td>
+ </tr>
<tr>
<td><br /></td>
<td>
--- /dev/null
+# -*- coding: utf-8 -*-
+from zope.publisher.browser import BrowserLanguages
+from Products.CMFCore.utils import getUtilityByInterfaceName
+
+class AuthenticatedUserLanguages(BrowserLanguages):
+
+ def getPreferredLanguages(self) :
+ mtool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IMembershipTool')
+ if mtool.isAnonymousUser() :
+ return super(AuthenticatedUserLanguages, self).getPreferredLanguages()
+ else :
+ m = mtool.getAuthenticatedMember()
+ userLangs = m.getProperty('preferred_languages', [])
+ return userLangs or super(AuthenticatedUserLanguages, self).getPreferredLanguages()