From b3374333f339a8e4e96bce04646f0b23fbca3ecf Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Tue, 1 Mar 2022 11:27:19 +0000 Subject: [PATCH] [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) --- .../Blog/templates/blog/make_post.html.twig | 4 +- .../collection_entry_view.html.twig | 4 +- .../collection/meta_collections.html.twig | 6 +-- .../templates/collection/notes.html.twig | 8 +-- .../templates/language/sort.html.twig | 8 +-- .../templates/left_panel/edit_feeds.html.twig | 2 +- .../templates/left_panel/view.html.twig | 6 +-- .../templates/right_panel/view.html.twig | 18 +++---- .../templates/cards/search/view.html.twig | 2 +- .../collection_entry_view.html.twig | 2 +- .../attachmentRelatedNotes.html.twig | 4 +- .../attachmentRelatedTags.html.twig | 6 +-- .../delete_note/delete_note.html.twig | 2 +- .../favourite/add_to_favourites.html.twig | 3 +- .../remove_from_favourites.html.twig | 3 +- .../NoteTypeFeedFilter/tabs.html.twig | 5 +- .../templates/repeat/add_to_repeats.html.twig | 3 +- .../repeat/remove_from_repeats.html.twig | 3 +- plugins/TreeNotes/TreeNotes.php | 2 +- .../tree_notes/note_replies_block.html.twig | 6 +-- templates/cards/blocks/navigation.html.twig | 12 ++--- templates/cards/blocks/note.html.twig | 51 ++++++++++--------- templates/cards/blocks/profile.html.twig | 4 +- templates/cards/macros/note/types.html.twig | 12 ++--- templates/cards/macros/widgets.html.twig | 4 +- 25 files changed, 93 insertions(+), 87 deletions(-) diff --git a/components/Blog/templates/blog/make_post.html.twig b/components/Blog/templates/blog/make_post.html.twig index 16f85f84d9..36847c55ea 100644 --- a/components/Blog/templates/blog/make_post.html.twig +++ b/components/Blog/templates/blog/make_post.html.twig @@ -1,10 +1,10 @@ {% extends 'stdgrid.html.twig' %} -{% block title %}{{ 'Create a blog post' | trans }}{% endblock %} +{% block title %}{% trans %}Create a blog post{% endtrans %}{% endblock %} {% block body %} {{ parent() }}
-

{{ 'Create a blog post' | trans }}

+

{% trans %}Create a blog post{% endtrans %}

{{ form(blog_entry_form) }}
{% endblock body %} diff --git a/components/Collection/templates/collection/collection_entry_view.html.twig b/components/Collection/templates/collection/collection_entry_view.html.twig index f0bedf5624..e67f16fa38 100644 --- a/components/Collection/templates/collection/collection_entry_view.html.twig +++ b/components/Collection/templates/collection/collection_entry_view.html.twig @@ -1,10 +1,10 @@ {% extends '/collection/notes.html.twig' %} -{% block title %}{{ page_title | trans }}{% endblock %} +{% block title %}{% trans %}%page_title%{% endtrans %}{% endblock %} {% block body %}
-

{{ page_title | trans }}

+

{% trans %}%page_title%{% endtrans %}

{% block collection_items %} {% endblock collection_items %}
diff --git a/components/Collection/templates/collection/meta_collections.html.twig b/components/Collection/templates/collection/meta_collections.html.twig index 2a591977a7..23ee41ba2e 100644 --- a/components/Collection/templates/collection/meta_collections.html.twig +++ b/components/Collection/templates/collection/meta_collections.html.twig @@ -1,17 +1,17 @@ {% extends 'stdgrid.html.twig' %} -{% block title %}{{ page_title | trans }}{% endblock %} +{% block title %}{% trans %}%page_title%{% endtrans %}{% endblock %} {% block body %}
-

{{ page_title | trans }}

+

{% trans %}%page_title%{% endtrans %}

{% if add_collection %}
{{ form(add_collection) }}
{% endif %}
-

{{ list_title | trans }}

+

{% trans %}%list_title%{% endtrans %}

{% for col in collections %}
{{ col.name }} diff --git a/components/Collection/templates/collection/notes.html.twig b/components/Collection/templates/collection/notes.html.twig index ba324f8bb3..e4c06b6a95 100644 --- a/components/Collection/templates/collection/notes.html.twig +++ b/components/Collection/templates/collection/notes.html.twig @@ -1,7 +1,7 @@ {% extends 'stdgrid.html.twig' %} {% 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 %} {{ parent() }} @@ -19,7 +19,7 @@ {% if notes_feed_title is defined %} {{ notes_feed_title.getHtml() }} {% endif %} -