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.
Assumptions
It should be possible for a site to add a new supported language without having to migrate content. (A modification in the code for your customer-specific package would be ok.)
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 contains 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.7 (2016-01-22)
- Don’t raise DefaultLanguageMissing when field is not required and no other values are given.
[moverkamp]
0.6 (2015-01-05)
Nothing changed yet.
0.5 (2015-01-05)
Nothing changed yet.
0.4 (2015-01-05)
Nothing changed yet.
0.3 (2015-01-05)
Nothing changed yet.
0.2 (2015-01-05)
Nothing changed yet.
0.1.1 (2015-01-02)
Nothing changed yet.
0.1 (2015-01-02)
Initial release
Metadata
Release files for collective.multilanguagefields 0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| collective.multilanguagefields-0.7.zip | 25.5 kB | Without provenance | Details |
Release files / collective.multilanguagefields-0.7.zip
| Download URL | collective.multilanguagefields-0.7.zip |
|---|---|
| Size | 25.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0044d101996870905235db5477e5bb66fd7b286eb87fdd42bb946258fb3ae27d
|
|
BLAKE2b-256 checksum How to use checksums |
1403c4cee79926c4496bc6093eee652df57025147a39b321153f360738f0020a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for collective.multilanguagefields 0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.