show translations on glossary and glossary items
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2257 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
b6bbc076cd
commit
c03bd7e8ac
8 changed files with 53 additions and 5 deletions
|
@ -75,6 +75,7 @@ class DialogAction(Action):
|
|||
dialogName = 'create'
|
||||
qualifier = typeToken = innerForm = None
|
||||
fixedType = False
|
||||
addParams = {}
|
||||
|
||||
@Lazy
|
||||
def url(self):
|
||||
|
@ -91,6 +92,7 @@ class DialogAction(Action):
|
|||
urlParams['inner_form'] = self.innerForm
|
||||
if self.fixedType:
|
||||
urlParams['fixed_type'] = 'yes'
|
||||
urlParams.update(self.addParams)
|
||||
return self.jsOnClick % (self.dialogName, self.page.virtualTargetUrl,
|
||||
self.viewName, urlencode(urlParams))
|
||||
|
||||
|
|
|
@ -364,7 +364,8 @@ class EditObject(FormController, I18NView):
|
|||
self.object = obj
|
||||
formState = self.updateFields()
|
||||
# TODO: error handling
|
||||
self.request.response.redirect(self.view.virtualTargetUrl + '?version=this')
|
||||
url = self.view.virtualTargetUrl + '?version=this'
|
||||
self.request.response.redirect(url)
|
||||
return False
|
||||
|
||||
def updateFields(self):
|
||||
|
|
|
@ -144,6 +144,12 @@ to the default language at the time of the attribute creation.
|
|||
>>> topic01.title.lower()
|
||||
u'loops for zope 3'
|
||||
|
||||
Viewing translations
|
||||
--------------------
|
||||
|
||||
>>> view.adapted.translations()
|
||||
{'en': u'loops for Zope 3', 'it': u'loops per Zope 3'}
|
||||
|
||||
|
||||
Fin de partie
|
||||
=============
|
||||
|
|
|
@ -128,3 +128,15 @@ class I18NAdapterBase(AdapterBase):
|
|||
self.checkAttr(attr)
|
||||
setI18nValue(self.context, '_' + attr, value, langInfo)
|
||||
|
||||
def translations(self, attr='title', omitCurrent=True):
|
||||
langInfo = self.languageInfo
|
||||
if langInfo:
|
||||
langs = langInfo.availableLanguages
|
||||
if len(langs) > 1:
|
||||
value = getattr(removeSecurityProxy(self.context), '_' + attr, None)
|
||||
if isinstance(value, I18NValue):
|
||||
result = dict((k, v) for k, v in value.items() if v)
|
||||
if omitCurrent and langInfo.language in result:
|
||||
del result[langInfo.language]
|
||||
return result
|
||||
return {}
|
||||
|
|
|
@ -68,10 +68,13 @@ class GlossaryItemView(ConceptView):
|
|||
def getActions(self, category='object', page=None):
|
||||
actions = []
|
||||
if category == 'portlet':
|
||||
lang = self.request.get('loops.language')
|
||||
langParam = lang and {'loops.language': lang} or {}
|
||||
actions.append(DialogAction(self, title='Edit Glossary Item...',
|
||||
description='Modify glossary item.',
|
||||
viewName='edit_glossaryitem.html',
|
||||
dialogName='editGlossaryItem',
|
||||
addParams=langParam,
|
||||
page=page))
|
||||
return actions
|
||||
|
||||
|
|
|
@ -27,6 +27,16 @@
|
|||
title related/description">
|
||||
Topic
|
||||
</a>
|
||||
<span tal:define="translations related/adapted/translations"
|
||||
tal:condition="translations">
|
||||
(<tal:trans repeat="trans translations"><a href="#"
|
||||
tal:attributes="href python: '%s?loops.language=%s' %
|
||||
(view.getUrlForTarget(related), trans);
|
||||
title translations/?trans"><i
|
||||
tal:content="trans">en</i></a><tal:comma
|
||||
condition="not:repeat/trans/end"
|
||||
>, </tal:comma></tal:trans>)
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</metal:block>
|
||||
|
@ -34,10 +44,21 @@
|
|||
|
||||
<metal:block define-macro="glossaryitem">
|
||||
<metal:title use-macro="item/conceptMacros/concepttitle" />
|
||||
<p tal:define="translations item/adapted/translations"
|
||||
tal:condition="translations">
|
||||
<span i18n:translate="">Translations</span>:
|
||||
<tal:trans repeat="trans translations"><a href="#"
|
||||
tal:attributes="href python: '%s?loops.language=%s' %
|
||||
(view.getUrlForTarget(item), trans);
|
||||
title translations/?trans"><i
|
||||
tal:content="trans">en</i></a><tal:comma
|
||||
condition="not:repeat/trans/end"
|
||||
>, </tal:comma></tal:trans>
|
||||
</p>
|
||||
<p>
|
||||
<span tal:repeat="related item/children">
|
||||
<tal:start condition="repeat/related/start">
|
||||
<span i18n:translate="">siehe</span>:</tal:start>
|
||||
<span i18n:translate="">See also</span>:</tal:start>
|
||||
<a href="#"
|
||||
tal:content="related/title"
|
||||
tal:attributes="href python: view.getUrlForTarget(related)">
|
||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
|||
|
||||
"Project-Id-Version: $Id$\n"
|
||||
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
||||
"PO-Revision-Date: 2007-12-04 12:00 CET\n"
|
||||
"PO-Revision-Date: 2007-12-17 12:00 CET\n"
|
||||
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -197,8 +197,11 @@ msgstr "major"
|
|||
msgid "minor"
|
||||
msgstr "minor"
|
||||
|
||||
msgid "see"
|
||||
msgstr "siehe"
|
||||
msgid "See also"
|
||||
msgstr "Siehe auch"
|
||||
|
||||
msgid "Translations"
|
||||
msgstr "Übersetzungen"
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Passwort ändern"
|
||||
|
|
Loading…
Add table
Reference in a new issue