5098 Posts in 1518 Topics by 1115 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1340 Views |
-
Language translation in SS 2.3.3 (Images & DataObjectManager ComplexTableField)

20 August 2009 at 10:12pm
Hey guys,
I am really impressed with the way in which the language translation functionality works in the latest SS. However, I am not sure how to do the following:
1) I would be able to inherit images from the default locale and use it for other languages in the backoffice and frontend
2) How would I be able to make language translations work for ComplexTableFields.
3) How would I allow these translations to be shown properly a table and be inherited for use in drop downs
-
Re: Language translation in SS 2.3.3 (Images & DataObjectManager ComplexTableField)

25 August 2009 at 9:31am
I don't get what you mean with "inherited" in 1) and 3), sorry.
> 2) How would I be able to make language translations work for ComplexTableFields.
http://open.silverstripe.com/ticket/4435Grüße
Ingo -
Re: Language translation in SS 2.3.3 (Images & DataObjectManager ComplexTableField)

26 August 2009 at 8:34pm
Hi Ingo,
Thank you for that ComplexTable fix.With regard to inheriting data in the database I will clarify with the following example:
1) Product X has many images
2) Product X has many colours
3) Product X has many categories it falls intoI need to translate Product X and retain 1-3
-
Re: Language translation in SS 2.3.3 (Images & DataObjectManager ComplexTableField)

27 August 2009 at 8:23am Last edited: 27 August 2009 8:24am
Ah, of course. Thats currently not possible, see http://open.silverstripe.com/ticket/3722
For a has_one relationship, you can work around it by overloading the getters/setters for the field.
For has_many/many_many, you could try overloading it and just returning the relations for any of the translations. A bit hacky, because it means that you still associate the objects with a translation, rather than the original:class Product extends DataObject {
$has_many = array('Colors'=>'Color');
function Colors() {
$ids = implode(',',$this->getTranslations()->column('ID'));
return $this->getComponents('Colors', sprintf('"Color"."ProductID" IN %s', $ids));
}
}
class Color extends DataObject {
$has_one = array('Product'=>'Product');
}You might get into trouble with the existing "ProductID = X" check generated by getComponents(), in whcih case you'd have to manipulate the query directly through getComponentsQuery(). Also note that the code doesn't have any error checking for empty sets etc.
| 1340 Views | ||
|
Page:
1
|
Go to Top |


