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}) }} »</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 ?
As you can see here:
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.