Skip to content

Commit d620160

Browse files
committed
Fix translator parameters
1 parent 77a47d3 commit d620160

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

config/packages/translation.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
# See https://symfony.com/doc/current/translation.html
12
framework:
23
default_locale: '%locale%'
34
translator:
5+
# Translations are defined using the ICU Message Format
6+
# See https://symfony.com/doc/current/translation/message_format.html
47
default_path: '%kernel.project_dir%/translations'
58
fallbacks:
69
- '%locale%'

src/EventSubscriber/CommentNotificationSubscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function onCommentCreated(CommentCreatedEvent $event): void
5252

5353
$subject = $this->translator->trans('notification.comment_created');
5454
$body = $this->translator->trans('notification.comment_created.description', [
55-
'%title%' => $post->getTitle(),
56-
'%link%' => $linkToPost,
55+
'title' => $post->getTitle(),
56+
'link' => $linkToPost,
5757
]);
5858

5959
// See https://symfony.com/doc/current/mailer.html

templates/admin/blog/edit.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block body_id 'admin_post_edit' %}
44

55
{% block main %}
6-
<h1>{{ 'title.edit_post'|trans({'%id%': post.id}) }}</h1>
6+
<h1>{{ 'title.edit_post'|trans({'id': post.id}) }}</h1>
77

88
{{ include('admin/blog/_form.html.twig', {
99
form: form,

templates/bundles/TwigBundle/Exception/error.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
{% block body_id 'error' %}
1414

1515
{% block main %}
16-
<h1 class="text-danger">{{ 'http_error.name'|trans({ '%status_code%': status_code }) }}</h1>
16+
<h1 class="text-danger">{{ 'http_error.name'|trans({ 'status_code': status_code }) }}</h1>
1717

1818
<p class="lead">
19-
{{ 'http_error.description'|trans({ '%status_code%': status_code }) }}
19+
{{ 'http_error.description'|trans({ 'status_code': status_code }) }}
2020
</p>
2121
<p>
22-
{{ 'http_error.suggestion'|trans({ '%url%': path('blog_index') })|raw }}
22+
{{ 'http_error.suggestion'|trans({ 'url': path('blog_index') })|raw }}
2323
</p>
2424
{% endblock %}
2525

templates/bundles/TwigBundle/Exception/error403.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{% block body_id 'error' %}
1414

1515
{% block main %}
16-
<h1 class="text-danger"><i class="fa fa-unlock-alt" aria-hidden="true"></i> {{ 'http_error.name'|trans({ '%status_code%': 403 }) }}</h1>
16+
<h1 class="text-danger"><i class="fa fa-unlock-alt" aria-hidden="true"></i> {{ 'http_error.name'|trans({ 'status_code': 403 }) }}</h1>
1717

1818
<p class="lead">
1919
{{ 'http_error_403.description'|trans }}

templates/bundles/TwigBundle/Exception/error404.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
{% block body_id 'error' %}
1414

1515
{% block main %}
16-
<h1 class="text-danger">{{ 'http_error.name'|trans({ '%status_code%': 404 }) }}</h1>
16+
<h1 class="text-danger">{{ 'http_error.name'|trans({ 'status_code': 404 }) }}</h1>
1717

1818
<p class="lead">
1919
{{ 'http_error_404.description'|trans }}
2020
</p>
2121
<p>
22-
{{ 'http_error_404.suggestion'|trans({ '%url%': path('blog_index') })|raw }}
22+
{{ 'http_error_404.suggestion'|trans({ 'url': path('blog_index') })|raw }}
2323
</p>
2424
{% endblock %}
2525

templates/bundles/TwigBundle/Exception/error500.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
{% block body_id 'error' %}
1919

2020
{% block main %}
21-
<h1 class="text-danger">{{ 'http_error.name'|trans({ '%status_code%': 500 }) }}</h1>
21+
<h1 class="text-danger">{{ 'http_error.name'|trans({ 'status_code': 500 }) }}</h1>
2222

2323
<p class="lead">
2424
{{ 'http_error_500.description'|trans }}
2525
</p>
2626
<p>
27-
{{ 'http_error_500.suggestion'|trans({ '%url%': path('blog_index') })|raw }}
27+
{{ 'http_error_500.suggestion'|trans({ 'url': path('blog_index') })|raw }}
2828
</p>
2929
{% endblock %}
3030

0 commit comments

Comments
 (0)