[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: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

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