[TEMPLATES][I18N] Fixup use of trans filter, in favour of trans tags. These are much more flexible and facilitate parameterized translations, rather than using concats. The only appropriate use of the trans filter is when a whole string in a variable needs to be translated (which should probably be avoided anyway)

This commit is contained in:
Hugo Sales 2022-03-01 11:27:19 +00:00
parent 0b864e85fd
commit b3374333f3
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
25 changed files with 93 additions and 87 deletions

View File

@ -1,10 +1,10 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% block title %}{{ 'Create a blog post' | trans }}{% endblock %} {% block title %}{% trans %}Create a blog post{% endtrans %}{% endblock %}
{% block body %} {% block body %}
{{ parent() }} {{ parent() }}
<section class="frame-section frame-section-padding"> <section class="frame-section frame-section-padding">
<h1>{{ 'Create a blog post' | trans }}</h1> <h1>{% trans %}Create a blog post{% endtrans %}</h1>
{{ form(blog_entry_form) }} {{ form(blog_entry_form) }}
</section> </section>
{% endblock body %} {% endblock body %}

View File

@ -1,10 +1,10 @@
{% extends '/collection/notes.html.twig' %} {% extends '/collection/notes.html.twig' %}
{% block title %}{{ page_title | trans }}{% endblock %} {% block title %}{% trans %}%page_title%{% endtrans %}{% endblock %}
{% block body %} {% block body %}
<div class="frame-section frame-section-padding"> <div class="frame-section frame-section-padding">
<h2 class="frame-section-title">{{ page_title | trans }}</h2> <h2 class="frame-section-title">{% trans %}%page_title%{% endtrans %}</h2>
{% block collection_items %} {% block collection_items %}
{% endblock collection_items %} {% endblock collection_items %}
</div> </div>

View File

@ -1,17 +1,17 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% block title %}{{ page_title | trans }}{% endblock %} {% block title %}{% trans %}%page_title%{% endtrans %}{% endblock %}
{% block body %} {% block body %}
<div class="frame-section frame-section-padding"> <div class="frame-section frame-section-padding">
<h2 class="frame-section-title">{{ page_title | trans }}</h2> <h2 class="frame-section-title">{% trans %}%page_title%{% endtrans %}</h2>
{% if add_collection %} {% if add_collection %}
<div class="frame-section section-form"> <div class="frame-section section-form">
{{ form(add_collection) }} {{ form(add_collection) }}
</div> </div>
{% endif %} {% endif %}
<div class="frame-section collections-list"> <div class="frame-section collections-list">
<h3>{{ list_title | trans }}</h3> <h3>{% trans %}%list_title%{% endtrans %}</h3>
{% for col in collections %} {% for col in collections %}
<div class="collection-item"> <div class="collection-item">
<a class="name" href="{{ fn.getUrl(col.id) }}">{{ col.name }}</a> <a class="name" href="{{ fn.getUrl(col.id) }}">{{ col.name }}</a>

View File

@ -1,7 +1,7 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% import '/cards/macros/note/factory.html.twig' as NoteFactory %} {% import '/cards/macros/note/factory.html.twig' as NoteFactory %}
{% block title %}{% if page_title is defined %}{{ page_title | trans }}{% endif %}{% endblock %} {% block title %}{% if page_title is defined %}{% trans %}%page_title%{% endtrans %}{% endif %}{% endblock %}
{% block stylesheets %} {% block stylesheets %}
{{ parent() }} {{ parent() }}
@ -19,7 +19,7 @@
{% if notes_feed_title is defined %} {% if notes_feed_title is defined %}
{{ notes_feed_title.getHtml() }} {{ notes_feed_title.getHtml() }}
{% endif %} {% endif %}
<nav class="feed-actions" title="{{ 'Actions that change how the feed behaves' | trans }}"> <nav class="feed-actions" title="{% trans %}Actions that change how the feed behaves{% endtrans %}">
<details class="feed-actions-details" role="group"> <details class="feed-actions-details" role="group">
<summary> <summary>
{{ icon('filter', 'icon icon-feed-actions') | raw }} {# button-container #} {{ icon('filter', 'icon icon-feed-actions') | raw }} {# button-container #}
@ -35,7 +35,7 @@
{% if notes is not empty %} {% if notes is not empty %}
{# Backwards compatibility with hAtom 0.1 #} {# Backwards compatibility with hAtom 0.1 #}
<section class="feed h-feed hfeed notes" role="feed" aria-busy="false" title="{{ 'Feed content' | trans }}"> <section class="feed h-feed hfeed notes" role="feed" aria-busy="false" title="{% trans %}Feed content{% endtrans %}">
{% for conversation in notes %} {% for conversation in notes %}
{% block current_note %} {% block current_note %}
{% if conversation is instanceof('array') %} {% if conversation is instanceof('array') %}
@ -45,7 +45,7 @@
{% set args = { 'type': 'vanilla_full', 'note': conversation, 'extra': { 'depth': 0 } } %} {% set args = { 'type': 'vanilla_full', 'note': conversation, 'extra': { 'depth': 0 } } %}
{{ NoteFactory.constructor(args) }}#} {{ NoteFactory.constructor(args) }}#}
{% endif %} {% endif %}
<hr class="hr-replies-end" role="separator" aria-label="{{ 'Marks the end of previous conversation\'s initial note' | trans }}"> <hr class="hr-replies-end" role="separator" aria-label="{% trans %}Marks the end of previous conversation's initial note{% endtrans %}">
{% endblock current_note %} {% endblock current_note %}
{% endfor %} {% endfor %}
</section> </section>

View File

@ -1,8 +1,8 @@
{% extends 'base.html.twig' %} {% extends 'base.html.twig' %}
{% block body %} {% block body %}
<div class="frame-section frame-section-padding"> <div class="frame-section frame-section-padding">
<h3>{{ 'Put the languages in the order you\'d like to see them in your language selection dropdown, when posting' | trans}}</h3> <h3>{% trans %}Put the languages in the order you'd like to see them in your language selection dropdown, when posting{% endtrans %}</h3>
{{ form(form) }} {{ form(form) }}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -15,7 +15,7 @@
{% block body %} {% block body %}
<div class="frame-section"> <div class="frame-section">
<form class="section-form" action="{{ path('edit_feeds') }}" method="post"> <form class="section-form" action="{{ path('edit_feeds') }}" method="post">
<h1 class="frame-section-title">{{ "Edit feed navigation links" | trans }}</h1> <h1 class="frame-section-title">{% trans %}Edit feed navigation links{% endtrans %}</h1>
{# Since the form is not separated into individual groups, this happened #} {# Since the form is not separated into individual groups, this happened #}
{{ form_start(edit_feeds) }} {{ form_start(edit_feeds) }}
{{ form_errors(edit_feeds) }} {{ form_errors(edit_feeds) }}

View File

@ -1,12 +1,12 @@
{% block leftpanel %} {% block leftpanel %}
<label class="panel-left-icon" for="toggle-panel-left" tabindex="-1">{{ icon('menu', 'icon icon-left') | raw }}</label> <label class="panel-left-icon" for="toggle-panel-left" tabindex="-1">{{ icon('menu', 'icon icon-left') | raw }}</label>
<a id="anchor-left-panel" class="anchor-hidden" tabindex="0" title="{{ 'Press tab followed by a space to access left panel' | trans }}"></a> <a id="anchor-left-panel" class="anchor-hidden" tabindex="0" title="{% trans %}Press tab followed by a space to access left panel{% endtrans %}"></a>
<input type="checkbox" id="toggle-panel-left" tabindex="0" title="{{ 'Open left panel' | trans }}"> <input type="checkbox" id="toggle-panel-left" tabindex="0" title="{% trans %}Open left panel{% endtrans %}">
<aside class="section-panel section-panel-left"> <aside class="section-panel section-panel-left">
<section class="panel-content accessibility-target"> <section class="panel-content accessibility-target">
{% if app.user %} {% if app.user %}
<section class='frame-section frame-section-padding' title="{{ 'Your profile information.' | trans }}"> <section class='frame-section frame-section-padding' title="{% trans %}Your profile information{% endtrans %}">
{% block profile_view %}{% include 'cards/blocks/profile.html.twig' with { actor: current_actor } %}{% endblock profile_view %} {% block profile_view %}{% include 'cards/blocks/profile.html.twig' with { actor: current_actor } %}{% endblock profile_view %}
{{ block("profile_current_actor", "cards/blocks/navigation.html.twig") }} {{ block("profile_current_actor", "cards/blocks/navigation.html.twig") }}
</section> </section>

View File

@ -13,7 +13,7 @@
<details class="section-details-subtitle frame-section"> <details class="section-details-subtitle frame-section">
<summary class="details-summary-subtitle"> <summary class="details-summary-subtitle">
<strong> <strong>
{{ "Additional options" | trans }} {% trans %}Additional options{% endtrans %}
</strong> </strong>
</summary> </summary>
<section class="section-form"> <section class="section-form">
@ -27,12 +27,12 @@
{% endmacro %} {% endmacro %}
{% macro posting_section_vanilla(widget) %} {% macro posting_section_vanilla(widget) %}
<section class="frame-section" title="{{ 'Create a new note.' | trans }}"> <section class="frame-section" title="{% trans %}Create a new note{% endtrans %}">
<details class="section-details-title" open="open" <details class="section-details-title" open="open"
title="{{ 'Expand if you want to access more options.' | trans }}"> title="{% trans %}Expand if you want to access more options{% endtrans %}">
<summary class="details-summary-title"> <summary class="details-summary-title">
<span> <span>
{{ "Create a note" | trans }} {% trans %}Create a note{% endtrans %}
</span> </span>
</summary> </summary>
@ -43,12 +43,12 @@
{% endmacro %} {% endmacro %}
{% macro posting_section_reply(widget, extra) %} {% macro posting_section_reply(widget, extra) %}
<section class="frame-section" title="{{ 'Create a new note.' | trans }}"> <section class="frame-section" title="{% trans %}Create a new note{% endtrans %}">
<details class="section-details-title" open="open" <details class="section-details-title" open="open"
title="{{ 'Expand if you want to access more options.' | trans }}"> title="{% trans %}Expand if you want to access more options{% endtrans %}">
<summary class="details-summary-title"> <summary class="details-summary-title">
<span> <span>
{{ "Reply to note" | trans }} {% trans %}Reply to note{% endtrans %}
</span> </span>
</summary> </summary>
@ -69,8 +69,8 @@
<label class="panel-right-icon" for="toggle-panel-right" <label class="panel-right-icon" for="toggle-panel-right"
tabindex="-1">{{ icon('chevron-left', 'icon icon-right') | raw }}</label> tabindex="-1">{{ icon('chevron-left', 'icon icon-right') | raw }}</label>
<a id="anchor-right-panel" class="anchor-hidden" tabindex="0" <a id="anchor-right-panel" class="anchor-hidden" tabindex="0"
title="{{ 'Press tab followed by a space to access right panel' | trans }}"></a> title="{% trans %}Press tab followed by a space to access right panel{% endtrans %}"></a>
<input type="checkbox" id="toggle-panel-right" tabindex="0" title="{{ 'Open right panel' | trans }}" <input type="checkbox" id="toggle-panel-right" tabindex="0" title="{% trans %}Open right panel{% endtrans %}"
{% if app.request.get('_route') == 'conversation_reply_to' %}checked{% endif %}> {% if app.request.get('_route') == 'conversation_reply_to' %}checked{% endif %}>
<aside class="section-panel section-panel-right"> <aside class="section-panel section-panel-right">

View File

@ -1,4 +1,4 @@
<section class="section-form form-search" title="{{ 'Search for notes, actors, and beyond' | trans }}"> <section class="section-form form-search" title="{% trans %}Search for notes, actors, and beyond{% endtrans %}">
{{ form_start(search) }} {{ form_start(search) }}
<span>{{ form_row(search.search_query) }}{{ form_row(search.submit_search) }}</span> <span>{{ form_row(search.search_query) }}{{ form_row(search.submit_search) }}</span>
{{ form_rest(search) }} {{ form_rest(search) }}

View File

@ -5,7 +5,7 @@
<section class="frame-section frame-section-padding"> <section class="frame-section frame-section-padding">
{% include '/cards/blocks/attachment.html.twig' with {'attachment': attachment, 'note': bare_notes[key], 'title': attachment.getBestTitle(bare_notes[key])} only %} {% include '/cards/blocks/attachment.html.twig' with {'attachment': attachment, 'note': bare_notes[key], 'title': attachment.getBestTitle(bare_notes[key])} only %}
<a class="frame-section-button-like" <a class="frame-section-button-like"
href="{{ attachment.getDownloadUrl(bare_notes[key]) }}"> {{ 'Download link' | trans }}</a> href="{{ attachment.getDownloadUrl(bare_notes[key]) }}">{% trans %}Download link{% endtrans %}</a>
</section> </section>
{% else %} {% else %}
<div id="empty-notes"><h1>{% trans %}No attachments here.{% endtrans %}</h1></div> <div id="empty-notes"><h1>{% trans %}No attachments here.{% endtrans %}</h1></div>

View File

@ -3,7 +3,7 @@
<section class="frame-section frame-section-padding"> <section class="frame-section frame-section-padding">
<div class="section-title"> <div class="section-title">
<span class="heading-no-margin"> <span class="heading-no-margin">
{{ 'Notes related' | trans }} {% trans %}Related notes{% endtrans %}
</span> </span>
</div> </div>

View File

@ -1,13 +1,13 @@
<section class="frame-section frame-section-padding"> <section class="frame-section frame-section-padding">
<div class="section-title"> <div class="section-title">
<span class="heading-no-margin"> <span class="heading-no-margin">
{{ 'Attachment tags' | trans }} {% trans %}Attachment tags{% endtrans %}
</span> </span>
</div> </div>
{% for tag in related_tags %} {% for tag in related_tags %}
<i>#{{ tag['tag'] }}</i> <i>#{{ tag['tag'] }}</i>
{% else %} {% else %}
{{ 'No tags' | trans }} {% trans %}No tags{% endtrans %}
{% endfor %} {% endfor %}
</section> </section>

View File

@ -1,7 +1,7 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% import "/cards/macros/note/factory.html.twig" as NoteFactory %} {% import "/cards/macros/note/factory.html.twig" as NoteFactory %}
{% block title %}{{ 'Delete ' | trans }}{{ 'note' | trans }}{% endblock %} {% block title %}{% trans %}Delete note{% endtrans %}{% endblock %}
{% block stylesheets %} {% block stylesheets %}
{{ parent() }} {{ parent() }}

View File

@ -1,7 +1,8 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% import "/cards/macros/note/factory.html.twig" as NoteFactory %} {% import "/cards/macros/note/factory.html.twig" as NoteFactory %}
{% block title %}{{ 'Favourite ' | trans }}{{ note.getActorNickname() }}{{ '\'s note.' | trans }}{% endblock %} {% set nickname = note.getActorNickname() %}
{% block title %}{% trans %}Favourite %nickname%'s note{% endtrans %}{% endblock %}
{% block stylesheets %} {% block stylesheets %}
{{ parent() }} {{ parent() }}

View File

@ -1,7 +1,8 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% import "/cards/macros/note/factory.html.twig" as NoteFactory %} {% import "/cards/macros/note/factory.html.twig" as NoteFactory %}
{% block title %}{{ 'Remove favourite from ' | trans }}{{ note.getActorNickname() }}{{ '\'s note.' | trans }}{% endblock %} {% set nickname = note.getActorNickname() %}
{% block title %}{% trans %}Remove favourite from %nickname%'s note{% endtrans %}{% endblock %}
{% block stylesheets %} {% block stylesheets %}
{{ parent() }} {{ parent() }}

View File

@ -1,7 +1,8 @@
{% for tab in tabs %} {% for tab in tabs %}
<li> <li>
<a href="{{ tab.url }}" title="{{ tab.active ? ('Hide ' ~ tab['icon']) : ('Show ' ~ tab['icon']) | trans }}"> {% set icon = tab['icon'] %}
{{ tab['icon'] }} <a href="{{ tab.url }}" title="{% if tab.active %}{% trans %}Hide %icon%{% endtrans %}{% else %}{% trans %}Show %icon%{% endtrans %}{% endif %}">
{{ icon }}
<span class="icon {{ tab.active ? 'icon-eye-opened' : 'icon-eye-closed' }}"></span> <span class="icon {{ tab.active ? 'icon-eye-opened' : 'icon-eye-closed' }}"></span>
</a> </a>
</li> </li>

View File

@ -1,7 +1,8 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% import "/cards/macros/note/factory.html.twig" as NoteFactory %} {% import "/cards/macros/note/factory.html.twig" as NoteFactory %}
{% block title %}{{ 'Repeat ' | trans }}{{ note.getActorNickname() }}{{ '\'s note.' | trans }}{% endblock %} {% set nickname = note.getActorNickname() %}
{% block title %}{% trans %}Repeat %nickname%'s note{% endtrans %}{% endblock %}
{% block stylesheets %} {% block stylesheets %}
{{ parent() }} {{ parent() }}

View File

@ -1,7 +1,8 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% import "/cards/macros/note/factory.html.twig" as NoteFactory %} {% import "/cards/macros/note/factory.html.twig" as NoteFactory %}
{% block title %}{{ 'Remove repeat from ' | trans }}{{ note.getActorNickname() }}{{ '\'s note.' | trans }}{% endblock %} {% set nickname = note.getActorNickname() %}
{% block title %}{% trans %}Remove repeat from %nickname%'s note{% endtrans %}{% endblock %}
{% block stylesheets %} {% block stylesheets %}
{{ parent() }} {{ parent() }}

View File

@ -72,7 +72,7 @@ class TreeNotes extends Plugin
'replies' => array_map( 'replies' => array_map(
fn ($n) => [ fn ($n) => [
'note' => $n, 'note' => $n,
'replies' => [], 'replies' => [], // We want only one depth level
'show_more' => ($n->getRepliesCount() > $max_replies_to_show), 'show_more' => ($n->getRepliesCount() > $max_replies_to_show),
'total_replies' => $n->getRepliesCount(), 'total_replies' => $n->getRepliesCount(),
], ],

View File

@ -1,10 +1,10 @@
{% import '/cards/macros/note/factory.html.twig' as NoteFactory %} {% import '/cards/macros/note/factory.html.twig' as NoteFactory %}
<section class="note-replies" title="{{ 'Replies to ' | trans }}{{ nickname }}{{ '\'s note' | trans }}"> <section class="note-replies" title="{% trans %}Replies to %nickname%'s note{% endtrans %}">
<div class="note-replies-start"></div> <div class="note-replies-start"></div>
<div class="u-in-reply-to replies"> <div class="u-in-reply-to replies">
{% for reply in conversation.replies %} {% for reply in conversation.replies %}
<span class="note-replies-indicator" role="presentation"></span> <span class="note-replies-indicator" role="presentation"></span>
{% set args = reply | merge({ 'type': 'vanilla_full' }) %} {% set args = reply | merge({ 'type': 'vanilla_full'}) %}
{{ NoteFactory.constructor(args) }} {{ NoteFactory.constructor(args) }}
{% endfor %} {% endfor %}
{% if conversation.show_more %} {% if conversation.show_more %}

View File

@ -9,7 +9,7 @@
{% set classes = {'details': 'section-details-title', 'summary': 'details-summary-title'} %} {% set classes = {'details': 'section-details-title', 'summary': 'details-summary-title'} %}
{% set summary %} {% set summary %}
<span>{{ 'Feeds' | trans }}</span> <span>{% trans %}Feeds{% endtrans %}</span>
{% if app.user %} {% if app.user %}
{# User custom feeds #} {# User custom feeds #}
<a class="edit-feed-link" href="{{ path('edit_feeds') }}">{{ icon('edit', 'icon icon-edit-feed') | raw }}</a> <a class="edit-feed-link" href="{{ path('edit_feeds') }}">{{ icon('edit', 'icon icon-edit-feed') | raw }}</a>
@ -17,12 +17,12 @@
{% endset %} {% endset %}
{% set expanded %} {% set expanded %}
<nav class="frame-section-padding" tabindex="0" title="{{ 'Navigate through each feed.' | trans }}"> <nav class="frame-section-padding" tabindex="0" title="{% trans %}Navigate through each feed{% endtrans %}">
{% if not app.user %} {# Default feeds #} {% if not app.user %} {# Default feeds #}
<ul> <ul>
<li> <li>
<a href="{{ path('feed_public') }}" class='hover-effect {{ active('feed_public') }}'> <a href="{{ path('feed_public') }}" class='hover-effect {{ active('feed_public') }}'>
{{ 'Feed' | trans }} {% trans %}Feed{% endtrans %}
</a> </a>
</li> </li>
</ul> </ul>
@ -57,12 +57,12 @@
{% endblock feeds %} {% endblock feeds %}
{% block profile_current_actor %} {% block profile_current_actor %}
<nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}"> <nav tabindex="0" class="profile-navigation" title="{% trans %}Navigate through account related pages{% endtrans %}">
<a title='{{ 'Access your account settings.' | trans }}' href="{{ path('person_actor_settings', {id: app.user.getId()}) }}" class='{{ active('settings') }}'> <a title="{% trans %}Access your account settings{% endtrans %}" href="{{ path('person_actor_settings', {id: app.user.getId()}) }}" class='{{ active('settings') }}'>
{% trans %}Settings{% endtrans %} {% trans %}Settings{% endtrans %}
</a> </a>
<a title='{{ 'Logout from your account.' | trans }}' href='{{ path('security_logout') }}'> <a title="{% trans %}Logout from your account{% endtrans %}" href='{{ path('security_logout') }}'>
{% trans %}Logout{% endtrans %} {% trans %}Logout{% endtrans %}
</a> </a>
</nav> </nav>

View File

@ -7,7 +7,7 @@
{{ icon('kebab', 'icon icon-note-actions-extra') | raw }} {{ icon('kebab', 'icon icon-note-actions-extra') | raw }}
</summary> </summary>
<menu> <menu>
<a href="{{ note.getUrl() }}">{{ 'Permalink' | trans }}</a> <a href="{{ note.getUrl() }}">{% trans %}Permalink{% endtrans %}</a>
<hr> <hr>
{% for current_action in get_extra_note_actions(note) %} {% for current_action in get_extra_note_actions(note) %}
<a class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}">{{ current_action['title'] }}</a> <a class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}">{{ current_action['title'] }}</a>
@ -26,7 +26,7 @@
{% if hide_attachments is not defined %} {% if hide_attachments is not defined %}
{% if note.getAttachments() is not empty %} {% if note.getAttachments() is not empty %}
<section class="note-attachments" tabindex="0" <section class="note-attachments" tabindex="0"
title="{{ 'Attachments for this note' | trans }}"> title="{% trans %}Attachments for this note{% endtrans %}">
{% for attachment in note.getAttachments() %} {% for attachment in note.getAttachments() %}
{% include 'cards/blocks/attachment.html.twig' with {'attachment': attachment, 'note': note, 'title': attachment.getBestTitle(note)} only %} {% include 'cards/blocks/attachment.html.twig' with {'attachment': attachment, 'note': note, 'title': attachment.getBestTitle(note)} only %}
{% endfor %} {% endfor %}
@ -37,7 +37,7 @@
{% block note_links %} {% block note_links %}
{% if note.getLinks() is not empty %} {% if note.getLinks() is not empty %}
<div class="note-links" title="{{ 'Shared links.' | trans }}"> <div class="note-links" title="{% trans %}Shared links{% endtrans %}">
{% for link in note.getLinks() %} {% for link in note.getLinks() %}
{% for block in handle_event('ViewLink', {'link': link, 'note': note}) %} {% for block in handle_event('ViewLink', {'link': link, 'note': note}) %}
{{ block | raw }} {{ block | raw }}
@ -49,7 +49,7 @@
{% block note_text %} {% block note_text %}
<div class="note-text" tabindex="0" <div class="note-text" tabindex="0"
title="{{ 'Main note content' | trans }}"> title="{% trans %}Main note content{% endtrans %}">
{% set paragraph_array = note.getRenderedSplit() %} {% set paragraph_array = note.getRenderedSplit() %}
{% for paragraph in paragraph_array %} {% for paragraph in paragraph_array %}
<p>{{ paragraph | raw }}</p> <p>{{ paragraph | raw }}</p>
@ -60,34 +60,34 @@
{% block note_author %} {% block note_author %}
{# Microformat's h-card properties indicates a face icon is a "u-logo" #} {# Microformat's h-card properties indicates a face icon is a "u-logo" #}
<a href="{{ actor_url }}" class="note-author-url u-url" <a href="{{ actor_url }}" class="note-author-url u-url"
title="{{ nickname }}{{ '\'s profile' | trans }}"> title="{% trans %}%nickname's profile{% endtrans %}">
{% if fullname is not null %}{{ fullname }}{% else %}{{ nickname }}{% endif %} {% if fullname is not null %}{{ fullname }}{% else %}{{ nickname }}{% endif %}
</a> </a>
<small class="note-author-uri" title="{{ 'Author related permalinks' | trans }}"> <small class="note-author-uri" title="{% trans %}Author related permalinks{% endtrans %}">
<a href="{{ actor_uri }}" class="u-url" title="{% trans %} %nickname%'s permalink {% endtrans %}">{{ mention }}</a> <a href="{{ actor_uri }}" class="u-url" title="{% trans %}%nickname%'s permalink {% endtrans %}">{{ mention }}</a>
</small> </small>
{% endblock note_author %} {% endblock note_author %}
{% block note_sidebar %} {% block note_sidebar %}
<aside class="note-sidebar" title="{{ nickname }} {{ 'avatar' | trans }}"> <aside class="note-sidebar" title="{% trans %}%nickname%'s avatar{% endtrans %}">
{% set actor_avatar_dimensions = actor.getAvatarDimensions() %} {% set actor_avatar_dimensions = actor.getAvatarDimensions() %}
<img class="u-logo avatar" src="{{ note.getActorAvatarUrl() }}" <img class="u-logo avatar" src="{{ note.getActorAvatarUrl() }}"
alt="{{ nickname }}'s avatar" alt="{% trans %}%nickname%'s avatar{% endtrans %}"
width="{{ actor_avatar_dimensions['width'] }}" width="{{ actor_avatar_dimensions['width'] }}"
height="{{ actor_avatar_dimensions['height'] }}"> height="{{ actor_avatar_dimensions['height'] }}">
</aside> </aside>
{% endblock note_sidebar %} {% endblock note_sidebar %}
{% block note_info %} {% block note_info %}
<header class="note-info" title="{{ 'Information about note\'s author' | trans }}"> <header class="note-info" title="{% trans %}Information about note's author{% endtrans %}">
{{ block('note_author') }} {{ block('note_author') }}
<small class="note-conversation-info" title="{{ 'Conversation related permalinks' | trans }}"> <small class="note-conversation-info" title="{% trans %}Conversation related permalinks{% endtrans %}">
<a href="{{ note.getConversationUrl() ~ '#' ~ note_anchor }}" <a href="{{ note.getConversationUrl() ~ '#' ~ note_anchor }}"
title="{{ 'Conversation\'s permalink' | trans }}" title="{% trans %}Conversation's permalink{% endtrans %}"
class="note-conversation-url">{{ 'in conversation' | trans }}</a> class="note-conversation-url">{% trans %}in conversation{% endtrans %}</a>
<a href="{{ note.getUrl() }}" <a href="{{ note.getUrl() }}"
title="{{ 'Note\'s permalink' | trans }}" title="{% trans %}Note's permalink{% endtrans %}"
class="note-url">{{ note.getModified() | ago }}</a> class="note-url">{{ note.getModified() | ago }}</a>
</small> </small>
</header> </header>
@ -100,17 +100,18 @@
{% if target.isGroup() %} {% if target.isGroup() %}
<em tabindex="0" <em tabindex="0"
class="note-replies-parent" class="note-replies-parent"
title="{{'The group in which this note was addressed to' | trans}}"> title="{% trans %}The group in which this note was addressed to{% endtrans %}">
{{'in ' | trans}} {% set mentionAnchor %}<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>{% endset %}
<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a> {% trans %}in %mentionAnchor%{% endtrans %}
</em> </em>
{% else %} {% else %}
<em tabindex="0" <em tabindex="0"
class="note-replies-parent" class="note-replies-parent"
title="{{'Whom this is a reply to' | trans}}" title="{% trans %}Whom this is a reply to{% endtrans %}"
aria-flowto="note-anchor-{{ note.getReplyTo() }}"> aria-flowto="note-anchor-{{ note.getReplyTo() }}">
<a href="{{ note.getConversationUrl() ~ '#note-anchor-' ~ note.getReplyTo() }}">{{'in reply to' | trans}}</a> {% set replyAnchor %}<a href="{{ note.getConversationUrl() ~ "#note-anchor-" ~ note.getReplyTo() }}">{% endset %}
<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a> {% set mentionAnchor %}<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>{% endset %}
{% trans %}%replyAnchor% in reply to %mentionAnchor%{% endtrans %}
</em> </em>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@ -122,8 +123,8 @@
{% if app.user is not null or complementary_info_array is not empty %} {% if app.user is not null or complementary_info_array is not empty %}
<aside <aside
title="{{ 'Additional note context information and actions' | trans }}" title="{% trans %}Additional note context information and actions{% endtrans %}"
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 %}
@ -133,14 +134,14 @@
{% for complementary_info_actor in complementary_info['actors'] %} {% for complementary_info_actor in complementary_info['actors'] %}
{% if app.user is not null %} {% if app.user is not null %}
{% if complementary_info_actor is defined and complementary_info_actor.getNickname() != app.user.nickname %} {% 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> <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 %} {% if counter == actor_count - 2 %}{{ ' and ' | trans }}{% endif %}
{% set counter = counter + 1 %} {% set counter = counter + 1 %}
{% endif %} {% endif %}
{% else %} {% else %}
{% if complementary_info_actor is defined %} {% 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> <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 %} {% if counter == actor_count - 2 %}{{ ' and ' | trans }}{% endif %}
{% set counter = counter + 1 %} {% set counter = counter + 1 %}
{% endif %} {% endif %}

View File

@ -54,13 +54,13 @@
<span class="profile-stats-subscriptions" <span class="profile-stats-subscriptions"
title="{% trans %} %actor_nickname%'s subscribed count{% endtrans %}"> title="{% trans %} %actor_nickname%'s subscribed count{% endtrans %}">
<strong> <strong>
<a href="{{ actor.getSubscriptionsUrl() }}">{{ 'Subscribed' | trans }}</a> <a href="{{ actor.getSubscriptionsUrl() }}">{% trans %}Subscribed{% endtrans %}</a>
</strong>{{ actor.getSubscribedCount() }} </strong>{{ actor.getSubscribedCount() }}
</span> </span>
<span class="profile-stats-subscribers" <span class="profile-stats-subscribers"
title="{% trans %} %actor_nickname%'s subscribers count{% endtrans %}"> title="{% trans %} %actor_nickname%'s subscribers count{% endtrans %}">
<strong> <strong>
<a href="{{ actor.getSubscribersUrl() }}">{{ 'Subscribers' | trans }}</a> <a href="{{ actor.getSubscribersUrl() }}">{% trans %}Subscribers{% endtrans %}</a>
</strong>{{ actor.getSubscribersCount() }} </strong>{{ actor.getSubscribersCount() }}
</span> </span>
</div> </div>

View File

@ -13,8 +13,8 @@
<article <article
tabindex="0" tabindex="0"
title="{{'A note by actor' | trans}} {{ nickname }}" title="{% trans %}A note by actor %nickname%{% endtrans %}"
id="{{ note_anchor }}" id="{{ 'note-anchor-' ~ note.getId() }}"
class="h-entry hentry note" class="h-entry hentry note"
lang="{{ note.getLanguageLocale() }}"> lang="{{ note.getLanguageLocale() }}">
{{ block('note_sidebar', 'cards/blocks/note.html.twig') }} {{ block('note_sidebar', 'cards/blocks/note.html.twig') }}
@ -22,7 +22,7 @@
<div class="note-wrapper"> <div class="note-wrapper">
{{ block('note_info', 'cards/blocks/note.html.twig') }} {{ block('note_info', 'cards/blocks/note.html.twig') }}
<section class="e-content entry-content note-content" title="{{ 'Note\'s main content' | trans }}"> <section class="e-content entry-content note-content" title="{% trans %}Note's main content{% endtrans %}">
{{ block('note_context', 'cards/blocks/note.html.twig') }} {{ block('note_context', 'cards/blocks/note.html.twig') }}
{{ block('note_text', 'cards/blocks/note.html.twig') }} {{ block('note_text', 'cards/blocks/note.html.twig') }}
{{ block('note_attachments', 'cards/blocks/note.html.twig') }} {{ block('note_attachments', 'cards/blocks/note.html.twig') }}
@ -53,7 +53,7 @@
<article <article
tabindex="0" tabindex="0"
title="{{'A note by actor' | trans}} {{ nickname }}" title="{% trans %}A note by actor %nickname%{% endtrans %}"
id="{{ 'note-compact-anchor-' ~ note.getId() }}" id="{{ 'note-compact-anchor-' ~ note.getId() }}"
class="h-entry hentry note" class="h-entry hentry note"
lang="{{ note.getLanguageLocale() }}"> lang="{{ note.getLanguageLocale() }}">
@ -63,10 +63,10 @@
{{ block('note_author', 'cards/blocks/note.html.twig') }} {{ block('note_author', 'cards/blocks/note.html.twig') }}
</header> </header>
<section class="e-content entry-content note-content-compact" title="{{ 'Note\'s main content' | trans }}"> <section class="e-content entry-content note-content-compact" title="{% trans %}Note's main content{% endtrans %}">
<small class="note-conversation-info"> <small class="note-conversation-info">
<a href="{{ note.getConversationUrl() }}" <a href="{{ note.getConversationUrl() }}"
class="note-conversation-url">{{ 'in conversation' | trans }}</a> class="note-conversation-url">{% trans %}in conversation{% endtrans %}</a>
<a href="{{ note.getUrl() }}" <a href="{{ note.getUrl() }}"
class="note-url">{{ note.getModified() | ago }}</a> class="note-url">{{ note.getModified() | ago }}</a>
</small> </small>

View File

@ -35,7 +35,7 @@
{% endmacro section %} {% endmacro section %}
{% macro details(blocks, classes, is_open = true) %} {% macro details(blocks, classes, is_open = true) %}
<details class="section-details {{ classes['details'] | default }}" {% if is_open %}open="open"{% endif %} title="{{ 'Expand if you want to access more options.' | trans }}"> <details class="section-details {{ classes['details'] | default }}" {% if is_open %}open="open"{% endif %} title="{% trans %}Expand if you want to access more options{% endtrans %}">
<summary class="details-summary {{ classes['summary'] | default }}"> <summary class="details-summary {{ classes['summary'] | default }}">
{% for widget in blocks['summary'] %} {% for widget in blocks['summary'] %}
{{ widget | raw }} {{ widget | raw }}