Display Templates: How to display metadata Names

In the following code I want to change <h6>Description</h6> to something that changes with locale....eg ^ca_objects.description.name (but this does not work)

{{{<ifdef code="ca_objects.description">

<div class='unit'><h6>Description</h6>

<span class="trimText">^ca_objects.description</span>



Note that the metadata content changes normally with locale.

But how can I make the "Description" text to change with locale?

Like I said ^ca_objects.description.name does not work...


  • Hi,

    So, as I understand, there is a metadata called "description" defined for an object, but you created a new metadata called "name" inside a container called "description"? 🤔 May a conflict exists between both "description" because, you cannot have "description" be at the same time a text metadata and a container.

    If you plan to create a new metadata for each displayed text in your detail page, that means you'll have to enter something in this metadata for each object in your collection?! 🤪

    Normally, you should use locale files (messages.mo and messages.po) for each language you want (see the directory themes/your_theme/locale), and use the function _t() to get the right text according to the selected language. Try to replace:



    <h6><?php print _t("Description"); ?></h6>

    or (as I saw in the /app/helpers/utilityHelpers.php file), more compact:

    <h6><?php _p("Description"); ?></h6>

    (And flush the cache files each time you change something...)

  • edited July 12

    darrigan Thank you! the _p(Description) worked, it was exactly what I was looking for!

    Is there somewhere a list of available functions like _t() or _p() ? Or you found them by browsing the code?

    Thanks again

  • Hi,

    Some tips are in the wiki part of the support, otherwise I dig into the code... 😁

  • :) Lots of digging

    Today I noticed that wiki seems to be offline (or most likely links are being moved?)

  • The old wiki was very useful! I hope it will come back!

    When I want to search something in the website, I use Google with the "site:" prefix, better than internal search engine. Example: site:collectiveaccess.org display

Sign In or Register to comment.