phpbolt-cms

How is BOLT cms echoing headings in aside?


I am new to bolt and i am trying to understand some of the code that comes in the default theme, i see the following code for the aside in my _aside.twig template:

{% for ct in config.get('contenttypes') if not ct.viewless|default(false) %}

            {% setcontent records = ct.slug ~ "/latest/3" %}

            <h5>{{ __('contenttypes.generic.recent', {'%contenttypes%': ct.name}) }}</h5>
            <ul>
                {% for record in records %}
                    <li><a href="{{ record.link }}">{{ record.title }}</a></li>
                {% else %}
                    <li>{{ __('contenttypes.generic.no-recent', {'%contenttype%': ct.slug}) }}</li>
                {% endfor %}
            </ul>
            <p><a href="{{ path('contentlisting', {'contenttypeslug': ct.slug}) }}">{{ __('contenttypes.generic.overview',{'%contenttypes%': ct.name}) }} &raquo;</a></p>


        {% endfor %}

I don't quite understand the below line of code:

{{ __('contenttypes.generic.recent', {'%contenttypes%': ct.name}) }}

What is the above line of code really doing , i know its adding the headings in the aside such as "latest articles" , "Recent articles" , but how does it really work ?


Solution

  • As you can see here:

    https://github.com/bolt/bolt/blob/66af6e9e450f0509a8d9d2c3c3c93b3e4bbd5b9c/app/resources/translations/en_GB/messages.en_GB.yml#L89

    These messages are namespaced for easy transalation. The code you mentioned it’s simply replacing the string %contenttypes% with the actual content type name, and printing the new message.