You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently field_include is pretty adaptable and supports most use cases out of the box including versioning relationships (translate RelationshipID) - but only in some cases.
Take the example of dnadesign/silverstripe-elemental :
It would be a reasonable use case to translate the whole "ElementalArea" (that's the name of the relationship) on a page - different locales/regions require different content, not necessarily different languages. Currently we could try to enable this with:
Unfortunately this doesn't really work as there's nothing that will create a new elemental area when being drafted into a new locale so you also have to add something like this:
publicfunctiononBeforeWrite()
{
parent::onBeforeWrite();
// if localised page instance is being created proceed to duplicate elemental data// NOTE clone elemental only if this page already exists otherwise there is nothing to cloneif (!$this->isDraftedInLocale() && $this->isInDB()) {
$elementalArea = $this->ElementalArea();
$elementalAreaNew = $elementalArea->duplicate();
$this->ElementalAreaID = $elementalAreaNew->ID;
}
return;
}
It would be great if Fluent supported this out of the box where we could instead have something like:
I think the feature needs to be clear that you are forcing a localised relationship to be exclusive to each locale; I.e. exclusively localised relations.
We would need to come up with rules on when / how these are duplicated; Does an initial write force a duplicate to be generated for each locale?
Good question, that is some project code that's not relevant. I'll update the example to exclude that bit
I think the feature needs to be clear that you are forcing a localised relationship to be exclusive to each locale; I.e. exclusively localised relations.
We would need to come up with rules on when / how these are duplicated; Does an initial write force a duplicate to be generated for each locale?
Yeah this is important. You have to be very careful (imo) about whether having an entirely different record for each locale is actually what you want. Elemental areas have a use case - but only because you might want the content to be laid out differently on your page depending on the locale. If you're looking for a shortcut to mark every field in every element as translatable then this is probably not the right solution.
Perhaps this is something that @silverstripeux has an opinion on.
Description
Currently
field_include
is pretty adaptable and supports most use cases out of the box including versioning relationships (translate RelationshipID) - but only in some cases.Take the example of dnadesign/silverstripe-elemental :
It would be a reasonable use case to translate the whole "ElementalArea" (that's the name of the relationship) on a page - different locales/regions require different content, not necessarily different languages. Currently we could try to enable this with:
Unfortunately this doesn't really work as there's nothing that will create a new elemental area when being drafted into a new locale so you also have to add something like this:
It would be great if Fluent supported this out of the box where we could instead have something like:
The text was updated successfully, but these errors were encountered: