Multi language fields for Plone
Project description
Introduction
This package aims to provide a simple way to make some fields on a dexterity content type available in more than one language (“multilanguage”). It tries to do what raptus.multilanguagefields does for Archetypes content types.
Usage
Multilanguage text line:
from collective.multilanguagefields.fields import TextLine as MLTextLine from plone.supermodel import model class IMyType(model.Schema): some_text = MLTextLine( title=_(u"Fieldname"), required=True, )
Features
Compatibility
Plone 4.3 and upwards.
Making Title field multilanguage
You cant use the default plone.app.content.interfaces.INameFromTitle behavior. Instead, use collective.multilanguagefields.interfaces.INameFromMultiLanguageTitle
In addition, your content type needs to implement its own Title() method which takes into account that the title attribute conatins a dictionary. The ml_value method from utils.py might be helpful.
Using multilanguage fields in templates
You can do this as follows:
<span tal:content="context/ml_value/my_field" />
You can also specify a default value:
- <span tal:define=”ml_value context/ml_value”
tal:content=”python: ml_value(‘my_field’, ‘no translation found’)” />
Changelog
0.1 (2015-01-02)
Initial release
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for collective.multilanguagefields-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6000a24ab5fe3d7f4d41c043f64f2d92cf42e3a841a29f9acb351cf07e29e7e3 |
|
MD5 | 7fec83a20477c0b5f954d8440057892a |
|
BLAKE2b-256 | 10b03ac9c93bb2f956491a1ae90b04882acbc7ddcdbd871b9472d22e6a23de49 |