Re: Content type`s fields translation in Page Template

Vincent Fretin <[email protected]>
Newsgroups gmane.comp.web.zope.plone.internationalization
Message-ID <[email protected]>
On Tue, Sep 7, 2010 at 1:27 PM, alexanderpas <[email protected]> wrote:
>
> That is exactly what I did, except labels in vocabs values, because my
> vocabularies are to large for this.
> Definitions like this:
>
> STAGE_LIST = DisplayList([
>               ('0','-'),
>               ('1',_(u'Business-idea')),
>               ('2',_(u'Initial stage')),
>               ('3',_(u'Expansion stage')),
>               ])
>
> And all vocab values are translated, but only in content type`s view, not in
> other template.
> And in my template i do pretty much the same as in
> Products/Archetypes/skins/archetypes/widgets/selection.pt   as shown in my
> previous post.

I didn't see anything in your previous post concerning the template.
You only wrote
<div tal:define="results python:context.scr()"
    tal:repeat="result results">

</div>
what do you do with result?

For each term of the vocabulary you have to call getValue like I said
in my previous post
Did you see that code in
Products/Archetypes/skins/archetypes/widgets/selection.pt ?

                        <option tal:repeat="item vocab"
                                tal:attributes="value item;
                                                selected python:item
in selection and 'selected' or None"
                                tal:content="python:vocab.getValue(item)"
                                i18n:translate=""
                                />

So I think something like this in your case:
<ul tal:define="results python:context.scr();
   vocab python:context.scr.Vocabulary(context)">
                        <li tal:repeat="item results"
                                tal:content="python:vocab.getValue(item)"
                                i18n:translate=""
                                />
</ul>

Vincent

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.