[TEMPLATES] Use transList and trans function for note complimentary info

This commit is contained in:
Hugo Sales 2022-03-01 13:13:55 +00:00
parent 070f53c10e
commit 90f9378bca
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 22 additions and 26 deletions

View File

@ -128,32 +128,28 @@
{% if complementary_info_array is not empty %} {% if complementary_info_array is not empty %}
<div class="note-complementary-info"> <div class="note-complementary-info">
{% for complementary_info in complementary_info_array %} {% for complementary_info in complementary_info_array %}
{% set actor_count = complementary_info['actors'] | length %} {% set formatted = [] %}
{% set counter = 0 %} {% if complementary_info['action'] is defined and not null %}
<span> <span>
{% for complementary_info_actor in complementary_info['actors'] %} {% for complementary_info_actor in complementary_info['actors'] %}
{% if app.user is not null %} {% if complementary_info_actor is defined and (app.user is null or complementary_info_actor.getNickname() != app.user.nickname) %}
{% if complementary_info_actor is defined and complementary_info_actor.getNickname() != app.user.nickname %} {% set tmp %}<a href="{{ complementary_info_actor.getUrl() }}">{{ complementary_info_actor.getNickname() }}</a>{% endset %}
<a href="{{ complementary_info_actor.getUrl() }}">{{ complementary_info_actor.getNickname() }}{% if actor_count > 1 and counter < actor_count - 2 %}{{ ', ' | trans }}{% endif %}</a>{# TODO translate properly#} {% set formatted = formatted|merge([tmp]) %}
{% if counter == actor_count - 2 %}{{ ' and ' | trans }}{% endif %}
{% set counter = counter + 1 %}
{% endif %}
{% else %}
{% if complementary_info_actor is defined %}
<a href="{{ complementary_info_actor.getUrl() }}">{{ complementary_info_actor.getNickname() }}{% if actor_count > 1 and counter < actor_count - 2 %}{{ ', ' | trans }}{% endif %}</a>{# TODO translate properly#}
{% if counter == actor_count - 2 %}{{ ' and ' | trans }}{% endif %}
{% set counter = counter + 1 %}
{% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{{ trans(
{% if complementary_info['action'] is defined and not null and counter > 0 %} {
{% if counter > 1 %}{{ ' have ' | trans }} '1': "{formatted} has {action} this note",
{% else %}{{ ' has ' | trans }} 'other': "{formatted} have {action} this note"
{% endif %}{{ complementary_info['action'] ~ ' this note' | trans }} },
{% endif %} {
'count': formatted|length,
'formatted': trans_list(formatted),
'action': complementary_info['action']
}
) | raw }}
</span> </span>
{% endif %}
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}