Hello Frank, Thanks for the help.
right. it is basically based on your mpgsite.i18n. I think what you
do(especially the "I18NWidget") should be a part of standard zope.
Thanks for the great package, I learned a lot from it. I downloaded the
svn version a couple of days ago but because of the "fb" package (as you
mentioned) which wasn't there I couldnt run it properly so I just
borrowed some parts (basically just the widget) and somehow made it
appear (just for the EDIT part not for the DISPLAY).
I understand that you are using the namespace approach. well, It is
possible to get the Dict form of the widget (for example
{'en':'something','jp':'something else'} ) . so when one says
<span tal:content="context/something"></span>
in the template, what appears is " {'en':'something','jp':'something
else'} "
I thought maybe by having a custom display format for the custom widget
then we can just check for the preferred language and return the
appropriate language version: namely "something" OR "something else"
This way we don't need to change the page template at all.
the problem is I cannot register a custom display format for the I18N
widget.
May be I am missing something, but even in the standard
zope.app.form.browser it says
<view
type="zope.publisher.interfaces.browser.IBrowserRequest"
for="zope.schema.interfaces.IURI"
provides="zope.app.form.interfaces.IDisplayWidget"
factory=".textwidgets.URIDisplayWidget"
permission="zope.Public"
/>
and in the .textwidgets.URIDisplayWidget it is apparently telling it to
place the URI inside <a></a> tags but this is not the case when you
display the URI widget using:
<span tal:content="context/someURI"></span>
so the view is not processed at all....
Now, If the zope:view tag only registers another view for the widget
then MAYBE the problem is how to activate that view i.e. set it as
default view.
I appreciate any help Frank.
+ if I can make the standard URI widget to appear in <a></a> tags then
the same solution is valid for my problem I think. So maybe some
zope3-developer guys can help as well. Thank you.
Hass
FB wrote:
Hi,
On Sat, Nov 25, 2006 at 04:17:24AM +0900, Hassan Alirezaei wrote:
Hello guys,
I have a custom widget and I cannot manage to have a custom way of
displaying it after editing.
as far as I know, I should be registering the view for
form.interfaces.IDisplayWidget(for display) and
form.interfaces.IInputWidget(for editing).
I use the following zcml lines:
<zope:view type="zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.app.form.interfaces.IInputWidget"
for="..interfaces.II18N"
factory=".widgets.SimpleI18NInputWidget"
permission="zope.Public" />
<zope:view type="zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.app.form.interfaces.IDisplayWidget"
for="..interfaces.II18N"
factory=".widgets.I18NSimpleDisplayWidget"
permission="zope.Public" />
This looks familiar :-) .
I don't know, if you used my I18NSimpleDisplayWidget. If you do: I can't
remember ever using this one - maybe it's not working as expected. In
most
cases, I needed those multilingual fields in page template which I used
a tales-namespace-adapter for.
I admit that mpgsite.i18n is a mess. I'm currently moving all the
i18n-stuff
into a different package (fb) which is much smaller than mpgsite.
fb.i18n has
some additional advantages:
* a special class is used as i18n-container (not a dict anymore).
This class
knows how to extract language versions, does some other fancy
stuff and
behaves like a dict otherwise.
* One language is marked as the "reference language" now
* a dedicated class makes it easy to i.e. extract all i18n-objects
from the *whole zodb* and make some poor guy translate them.
* Documentation is in english
* dependencies are clear:
* fb.fields: for displaying fancy help in edit forms
* fb.skin's header-viewletprovider which is easy providable by
your own skin, too
* fb.searchengines: for automatically presenting all language
versions
to user agents identified as search engines (I asked a
google-guy: It's
ok to do so).
The fb-package is available via svn here:
https://fbo.no-ip.org/svn/fbo/fb
The package is not complete, yet. But it will be at the end of the
next week.
Regards,
Frank
_______________________________________________
Zope3-users mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zope3-users
_______________________________________________
Zope3-users mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zope3-users