freemarkerliferay-6.2

Liferay Appilcation Display Template showing wrong language


at the moment I'm developing an ADT for an Asset Publisher that shows a short Version of each Web Content. In the Web Content Structure there is a Field named "content" and it's just a simple HTML Field.

<dynamic-element dataType="html" fieldNamespace="ddm" indexType="text" localizable="true" name="content" readOnly="true" repeatable="false" required="true" showLabel="true" type="ddm-text-html" width="25">
    <meta-data locale="de_DE">
        <entry name="label">
            <![CDATA[Content]]>
        </entry>
        <entry name="predefinedValue">
            <![CDATA[]]>
        </entry>
        <entry name="tip">
            <![CDATA[]]>
        </entry>
    </meta-data>
</dynamic-element>

When creating the Web Content the Creator can set a Translation to English (US).

The funny thing is that if he doesn't add a translation, the ADT is showing the German version of the Field "content" (Which is the right way). When adding the translation, the ADT is showing the English one (But it should show the German one, because German is set as the default language).

The relevant part of the ADT is this:

<#assign aArticleXML = saxReaderUtil.read(aArticle.getContent()) >
<#assign content = aArticleXML.valueOf("//dynamic-element[@name='content']/dynamic-content/text()") />
...
<p>${content}</p>

Does anyone know this problem?

I appreciate your help.


Solution

  • After some time I figured it out by myself.

    There are two functions you can call on the Article in your ADT.

    Thanks to everyone who tried to solve this.