<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Get localized expando value in freemarker template</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=95063723" />
  <subtitle>Get localized expando value in freemarker template</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=95063723</id>
  <updated>2026-04-08T00:42:39Z</updated>
  <dc:date>2026-04-08T00:42:39Z</dc:date>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118100394" />
    <author>
      <name>Aravinth Kumar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118100394</id>
    <updated>2019-12-17T10:37:37Z</updated>
    <published>2019-12-17T10:37:37Z</published>
    <summary type="html">Hi All,&lt;br /&gt;Is there any better solution provided in the recent versions? &lt;br /&gt;Thanks in Advance.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Aravinth</summary>
    <dc:creator>Aravinth Kumar</dc:creator>
    <dc:date>2019-12-17T10:37:37Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110618297" />
    <author>
      <name>Mladen B.</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110618297</id>
    <updated>2018-07-22T09:31:08Z</updated>
    <published>2018-07-22T09:31:08Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;I also had this issue and it took me several hours to finally resolve
  it (Liferay Community Edition Portal 7.0.6 GA7)... It's really
  unfortunate that in this version of LR we still have this issue,
  preventing people from doing basic actions, like properly iterate a collection...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Anyway, your example helped a lot, with a remark that &lt;b&gt;
    &lt;code&gt;key_index&lt;/code&gt;&lt;/b&gt; should actually be &lt;b&gt;
    &lt;code&gt;key?index&lt;/code&gt;&lt;/b&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Mladen B.</dc:creator>
    <dc:date>2018-07-22T09:31:08Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=96580020" />
    <author>
      <name>Elena Stefanova</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=96580020</id>
    <updated>2017-10-09T14:32:31Z</updated>
    <published>2017-10-09T14:32:31Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;I finally managed to find a solution that works for me and it looks like this: &lt;br&gt;&lt;pre&gt;&lt;code&gt;
&amp;amp;lt;#list expandoAttribute?keys as key&amp;amp;gt;
&amp;amp;lt;#if key == locale&amp;amp;gt;
&amp;amp;lt;#assign value = expandoAttribute?values[key_index] /&amp;amp;gt;
&amp;lt;!--#if--&amp;gt;
&amp;lt;!--#list--&amp;gt;

${value}
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Apparently, it was a matter of choosing the correct freemarker method to access the extended_hash value. Might not be the best solution, but at least it helped me get what I need &lt;img alt="emoticon" src="@theme_images_path@/emoticons/bashful.gif"&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Elena Stefanova</dc:creator>
    <dc:date>2017-10-09T14:32:31Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95222022" />
    <author>
      <name>Elena Stefanova</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95222022</id>
    <updated>2017-09-20T13:56:07Z</updated>
    <published>2017-09-20T13:56:07Z</published>
    <summary type="html">Ok, Massimo!&lt;br /&gt;&lt;br /&gt;Thank you very much anyway!</summary>
    <dc:creator>Elena Stefanova</dc:creator>
    <dc:date>2017-09-20T13:56:07Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95202152" />
    <author>
      <name>Massimo Bevilacqua</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95202152</id>
    <updated>2017-09-20T07:39:30Z</updated>
    <published>2017-09-20T07:39:30Z</published>
    <summary type="html">Now I understand the problem,&lt;br /&gt;if you have custom attribute and for example you add as value &amp;#34;Hello&amp;#34; in english and &amp;#34;Hallo&amp;#34; in german when you retrive the values liferay print&lt;br /&gt;&amp;#34;HelloHallo&amp;#34;&lt;br /&gt;This is how data is stored in my case:&lt;br /&gt;&lt;blockquote&gt;{valueId=49020, companyId=20116, tableId=48997, columnId=49000, rowId=49019, classNameId=29201, classPK=49018, data=HalloHello}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I made some test but I was not able to solve the problem, I am sorry.</summary>
    <dc:creator>Massimo Bevilacqua</dc:creator>
    <dc:date>2017-09-20T07:39:30Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95071126" />
    <author>
      <name>Elena Stefanova</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95071126</id>
    <updated>2017-09-19T13:49:22Z</updated>
    <published>2017-09-19T13:49:22Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Ok, so here are the steps to reproduce the scenario:&lt;br&gt;1. Go to Control Panel -&amp;gt; Configuration -&amp;gt; Custom Fields -&amp;gt; Page -&amp;gt; Add Custom Field&lt;br&gt;2. Add a new field with key: Page Title, type: Localized Text.&lt;br&gt;3. Go to theme portal_normal.flt template and add the following code:&lt;br&gt; &lt;pre&gt;&lt;code&gt;
&amp;amp;lt;#assign expandoAttribute = layout.getExpandoBridge().getAttribute("Page Title") /&amp;amp;gt;
&amp;lt;!-- Print the attribute value with the current locale --&amp;gt;
&amp;lt;p&amp;gt;${expandoAttribute[locale]}&amp;lt;/p&amp;gt;
or 
&amp;lt;p&amp;gt;${expandoAttribute.get( locale )}&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;4. Go and test this on some page on frontend.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Elena Stefanova</dc:creator>
    <dc:date>2017-09-19T13:49:22Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95069864" />
    <author>
      <name>Massimo Bevilacqua</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95069864</id>
    <updated>2017-09-19T13:19:52Z</updated>
    <published>2017-09-19T13:19:52Z</published>
    <summary type="html">Could you please paste your template code so I can test it?</summary>
    <dc:creator>Massimo Bevilacqua</dc:creator>
    <dc:date>2017-09-19T13:19:52Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95069478" />
    <author>
      <name>Elena Stefanova</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95069478</id>
    <updated>2017-09-19T12:53:12Z</updated>
    <published>2017-09-19T12:53:12Z</published>
    <summary type="html">Liferay 7, ga4</summary>
    <dc:creator>Elena Stefanova</dc:creator>
    <dc:date>2017-09-19T12:53:12Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95069453" />
    <author>
      <name>Massimo Bevilacqua</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95069453</id>
    <updated>2017-09-19T12:50:33Z</updated>
    <published>2017-09-19T12:50:33Z</published>
    <summary type="html">Which version of liferay are you using?</summary>
    <dc:creator>Massimo Bevilacqua</dc:creator>
    <dc:date>2017-09-19T12:50:33Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95067097" />
    <author>
      <name>Elena Stefanova</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95067097</id>
    <updated>2017-09-19T11:58:30Z</updated>
    <published>2017-09-19T11:58:30Z</published>
    <summary type="html">Yes, this prints the correct keys and values but if I have 2 values for this attribute( for example en_GB and es_ES translations ), then I got all of them and I need to print only the current one - the one that is relevant to the current site locale.</summary>
    <dc:creator>Elena Stefanova</dc:creator>
    <dc:date>2017-09-19T11:58:30Z</dc:date>
  </entry>
  <entry>
    <title>RE: Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95064170" />
    <author>
      <name>Massimo Bevilacqua</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95064170</id>
    <updated>2017-09-19T10:51:15Z</updated>
    <published>2017-09-19T10:51:15Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;HI,&lt;br&gt;&lt;br&gt;Try to print the key value to see if your the key locale is present.&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;amp;lt;#list expandoAttribute?keys as key&amp;amp;gt;
${key}
&amp;lt;!--#list--&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Otherwise try to use values instead of key(I had problem iterating map with keys)&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;amp;lt;#list expandoAttribute?values as field&amp;amp;gt;
${field}
&amp;lt;!--#list--&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Massimo Bevilacqua</dc:creator>
    <dc:date>2017-09-19T10:51:15Z</dc:date>
  </entry>
  <entry>
    <title>Get localized expando value in freemarker template</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95063722" />
    <author>
      <name>Elena Stefanova</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=95063722</id>
    <updated>2017-09-19T10:15:21Z</updated>
    <published>2017-09-19T10:15:21Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi, there!&lt;br&gt;&lt;br&gt;I have the following problem. I've added a new custom attribute to my site pages. The attribute is of type "Localized text". Now I need to get and show  this attribute value in one of my freemarker theme templates. However,  I'm not able to do it by some reason. The site is multi-lingual and I want to view the correct value of this attribute according to the locale that is set currently. Code of type:&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;amp;lt;#assign expandoAttribute = layout.getExpandoBridge().getAttribute("ATTRIBUTE_NAME") /&amp;amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;returns a result of type extended_hash, but I cannot access its elements the way I need.&lt;br&gt;I tried this way:&lt;br&gt;&lt;pre&gt;&lt;code&gt;${expandoAttribute.get( locale )}&lt;/code&gt;&lt;/pre&gt; &lt;br&gt;as well as:&lt;br&gt;&lt;pre&gt;&lt;code&gt; &amp;amp;lt;#assign value = expandoAttribute[locale] /&amp;amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;and also:&lt;br&gt;&lt;pre&gt;&lt;code&gt;
&amp;amp;lt;#list expandoAttribute?keys as key&amp;amp;gt;
&amp;amp;lt;#if key == locale&amp;amp;gt;
&amp;amp;lt;#assign value = expandoAttribute[key] /&amp;amp;gt;
&amp;lt;!--#if--&amp;gt;
&amp;lt;!--#list--&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;but I got only debug errors saying that the value is evaluated to null or missing. &lt;img alt="emoticon" src="@theme_images_path@/emoticons/sad.gif"&gt;&lt;br&gt;&lt;br&gt;Any help or advice will be appreciated!&lt;br&gt;&lt;br&gt;Thanks in advance!&lt;br&gt;&lt;br&gt;Eli&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Elena Stefanova</dc:creator>
    <dc:date>2017-09-19T10:15:21Z</dc:date>
  </entry>
</feed>
