[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

@ -127,34 +127,30 @@
class="note-complementary"> class="note-complementary">
{% 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 %} {% endif %}
{% else %} {% endfor %}
{% if complementary_info_actor is defined %} {{ trans(
<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 %} '1': "{formatted} has {action} this note",
{% set counter = counter + 1 %} 'other': "{formatted} have {action} this note"
{% endif %} },
{% endif %} {
{% endfor %} 'count': formatted|length,
'formatted': trans_list(formatted),
{% if complementary_info['action'] is defined and not null and counter > 0 %} 'action': complementary_info['action']
{% if counter > 1 %}{{ ' have ' | trans }} }
{% else %}{{ ' has ' | trans }} ) | raw }}
{% endif %}{{ complementary_info['action'] ~ ' this note' | trans }} </span>
{% endif %} {% endif %}
</span> {% endfor %}
{% endfor %}
</div> </div>
{% endif %} {% endif %}