marr
marr

Reputation: 861

Displaying Localized Vocabulary on Skin-based Folder Listing

I understand it's better to write browser view in a product, but want to know if there's any quick solution to the following task.

I have a custom Dexterity type with a cities field:

cities = schema.List(
  title=_(u"Cities"),
  value_type=schema.Choice(
    vocabulary='cities',
    required=False,
  ),
)

Values in the vocabularies.py look like:

SimpleTerm(value="NewYorkCity", title=_(u"New York City")),

Now I want utilize Skin-based template folder_listing.pt and add the following to display the cities values.

<tal:cities condition="item_obj/cities"
          tal:repeat="city item_obj/cities">
  <span tal:replace="city">Value</span>
  <span class="separator" tal:condition="not:repeat/city/end">,</span>
</tal:cities>

It displays the results as NewYorkCity, but I really want is its translated title in Chinese, like 紐約市. If feasible, how can I meet this needs with template customization?

Upvotes: 0

Views: 61

Answers (1)

C&#233;dric Messiant
C&#233;dric Messiant

Reputation: 46

I think that you just need to use i18n:domain and i18n:translate :

<span i18n:domain="yourdomain" i18n:translate="" tal:replace="city">Value</span>

(see http://wiki.zope.org/zope3/ZPTInternationalizationSupport)

Upvotes: 1

Related Questions