Check nodes translations

Author Message

Tobias Persson

Thursday 22 January 2004 1:36:54 am

Hi,

I am trying to convert a site that has 5 different languages and partially the same content to EZ.

But I need a way to just show the content that has been translated on each site. Ie if I have created product1 on english and it hasn't been translated to swedish yet, I don't want to show it on the swedish site.

Is this possible to do in some easy way, or do I have to check the language_list for every node?

Balazs Halasy

Thursday 22 January 2004 2:44:39 am

Currently eZ publish will display the default language version of the content object - in other words, if Swedish is the default language and an English translation doesn't exist then it WILL display the Swedish one. This is a bit unfortunate and I think it will be replaced by some alternate functionality in the future (has been discussed on the internal developer mailing list). However, you could do some trick in your template: check which language it is and display something else if it is not the correct language, etc.

Balazs

Tobias Persson

Thursday 22 January 2004 3:01:27 am

Thanks for the quick reply :)

I will do like this for now then.

{let ThisLang=$node.object.default_language}

{section name=Lang loop=$node.contentobject_version_object.language_list}
{switch name=Sw1 match=$ThisLang}
{case match=$Lang:item.language_code}

{* output stuff *}

{/case}
{switch}
{/section}

{/let}

/Tobbe

Heiner Wurbs

Tuesday 24 January 2006 3:33:24 am

this is fine and fast, use in the fetch statement the only_translated parameter, like:

fetch(content, list, hash(parent_node_id, $node.node_id, only_translated, true() ) )  

Cheers,
Heiner

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.