Re: Content type`s fields translation in Page Template
Vincent Fretin <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.internationalization |
|---|---|
| Message-ID | <[email protected]> |
You need to create your vocabulary like this:
from Products.Archetypes.public import DisplayList
from zope.i18nmessageid import MessageFactory
_ = MessageFactory('my.product')
CATEGORY_VOCABULARY = DisplayList([('general', _('label_general_news',
default=u'General News')),
('lifeofthenetwork', _('label_lifeofthenetwork',
default=u"Life of the network")),
('trainingcatalog', _('label_training_catalog',
default=u"Training catalog")),])
And set in your archetype field:
vocabulary=CATEGORY_VOCABULARY,
or a string, in this case you have to implement the method which
return a DisplayList.
Then you can use i18ndude to extract your messages and translate them.
and in your template, something like:
tal:content="python:vocab.getValue(item)"
i18n:translate=""
please look at Products/Archetypes/skins/archetypes/widgets/selection.pt
Vincent Fretin
Ecreall
Site : http://vincentfretin.ecreall.com
On Tue, Sep 7, 2010 at 10:39 AM, alexanderpas <[email protected]> wrote:
>
> Thanks fo request so fast.
> Before, to store values I used a List. And getField() method gave me
> translated values.
> But now I use Vocabulary for storing.
>
> To get values from Vocabulary in page template:
>
> <div tal:define="results python:context.scr()"
> tal:repeat="result results">
>
> </div>
>
> I use my product`s domain. But also tried 'plone' domain, previously
> extended it with my translation.
>
> May be I don`t correctly understand translation machinery. Do I need to use
> i18ndude to translate my template, or template can use already existing
> product`s translation?
> --
> View this message in context: http://plone-regional-forums.221720.n2.nabble.com/Content-type-s-fields-translation-in-Page-Template-tp5503389p5505632.html
> Sent from the Internationalization mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> 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
> _______________________________________________
> Plone-i18n mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/plone-i18n
>
------------------------------------------------------------------------------
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