Forums / Developer / Getting related objects with empty attributes / Locale pb

Getting related objects with empty attributes / Locale pb

Author Message

Antoine W.

Tuesday 30 August 2005 8:43:10 am

Hi,

I just did a test of <i>related objects</i> and translations, with the following objects :

object#1 is available in english (<i>eng-GB</i>).
object#2 is available in english and translated in german (<i>ger-DE</i>).
object#1 is related to object#2.

I created a siteaccess for german, with <i>ContentObjectLocale</i> set to <i>ger-DE</i>.

When I try to display object#1, I get the english version of this object because german translation is not available - thats OK.

But when I try to display related objects to object#2, <i>$node.object.related_contentobject_array[0].main_node</i> will contain object#1 with every attributes <b>empty</b> (in data_map) instead of attributes in english version.
That's a strange behavior !
I thought that it would fetch automatically the attributes in english when there is no translation for the current locale.

Is it normal ? What can I do to display the english version of related objects, when not available in current locale ?

For the moment, I fetch again objects by nodeid from the related_contentobject_array, but it's really not optimised...

{let topic=$node.object.related_contentobject_array[0].main_node}
{* Here, every attributes in $topic.data_map will be EMPTY! *}

{set topic=fetch( content, node, hash( node_id, $topic.node_id ))}
{* Fetching it again, it will be ok : attributes in $topic.data_map will be in english *}