{% set event = event | default(entity) %}
{%- set embedded = embedded | default(False) -%}
{%- set person_context = entity_contexts['person'] -%}
{%- macro person_label(person) -%}
    {% include 'entity/label--person.html.j2' %}
{%- endmacro -%}
{%- set formatted_event = event.event_type.plugin_label() | localize -%}
{%- if event is persistent_entity_id and not embedded -%}
    {% set formatted_event = ('<a href="' + event | localized_url + '">' + formatted_event + '</a>') | safe %}
{%- endif -%}
{%- if event.description -%}
    {% set formatted_event = formatted_event + ' (' + event.description | localize + ')' | safe %}
{%- endif -%}
{%- set subjects = event.presences | select('public') | selectattr('role', 'subject_role') | map(attribute='person') | select('public') | list -%}
{%- set non_context_subjects = subjects | reject('eq', person_context) | list -%}
{%- set formatted_subjects = non_context_subjects | map(person_label) | join(', ') %}
{%- if non_context_subjects | length == 0 -%}
    {{ formatted_event }}
{%- else -%}
    {%- if person_context in subjects -%}
        {% trans event = formatted_event, subjects = formatted_subjects -%}
            {{ event }} with {{ subjects }}
        {%- endtrans %}
    {%- else -%}
        {% trans event = formatted_event, subjects = formatted_subjects -%}
            {{ event }} of {{ subjects }}
        {%- endtrans %}
    {%- endif -%}
{%- endif -%}
