Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 60d38cb

Browse files
Working with Translation
1 parent 96b8900 commit 60d38cb

File tree

8 files changed

+26
-19
lines changed

8 files changed

+26
-19
lines changed

‎src/Controller/PasswordChangeController.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
1919
use App\Attribute\FillDto;
2020

21+
use function Symfony\Component\Translation\t;
22+
2123
class PasswordChangeController extends AbstractController
2224
{
2325
public function __construct(private PasswordChangeService $passwordChangeService)
@@ -36,7 +38,7 @@ public function change(
3638
$errors = $validator->validate($passwordChangeRequest);
3739
if (count($errors) == 0) {
3840
$this->passwordChangeService->execute($passwordChangeRequest);
39-
$this->addFlash('message','Password changed successfully');
41+
$this->addFlash('message',t('password.changed_successfully'));
4042
return $this->redirectToRoute('home');
4143
}
4244
}

‎templates/home/index.html.twig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
<h3>Your Front Page</h3>
88
<a href="{{ path('app_login') }}">Login</a>
9-
<a href="{{ path('register_form') }}">Register</a>
9+
<a href="{{ path('register') }}">Register</a>
1010

1111
{% endblock %}

‎templates/reset_password/check_email.html.twig‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
{% block body %}
66
<div class="md:w-6/12 mx-auto w-full">
7-
<p class="text-center">An email has been sent that contains a link that you can click to reset your password.
8-
This link will expire in {{ tokenLifetime|date('g') }} hour(s).</p>
7+
<p class="text-center">
8+
{{ 'password.email_sent'|trans({hour: tokenLifetime|date('g')}) }}
9+
</p>
910
<p>If you don't receive an email please check your spam folder or
1011
<a class="font-bold" href="{{ path('app_forgot_password_request') }}">try again</a>.
1112
</p>

‎templates/reset_password/request.html.twig‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
{% extends 'base.html.twig' %}
22

3-
{% block title %}Reset your password{% endblock %}
3+
{% block title %}{{ 'Reset your password'|trans }}{% endblock %}
44

55
{% block body %}
66
<div class="w-full md:w-1/2 mx-auto">
77
{% for flashError in app.flashes('reset_password_error') %}
88
<div class="bg-red-400 p-3" role="alert">{{ flashError }}</div>
99
{% endfor %}
10-
<h1>Reset your password</h1>
10+
<h1>{{'Reset your password'|trans}}</h1>
1111

1212
{{ form_start(requestForm) }}
1313
{{ form_row(requestForm.email) }}
1414

1515
<p class="p-4 m-3 text-gray-500">
16-
Enter your email address and we we will send you a
17-
link to reset your password.
16+
{{ 'password.enter_email'|trans }}
1817
</p>
1918
<div class="text-center">
20-
<button class="bg-green-600 p-3 text-white">Send password reset email</button>
19+
<button class="bg-green-600 p-3 text-white">{{ 'password.send_email_btn'|trans }}</button>
2120
{{ form_end(requestForm) }}
2221
</div>
2322
</div>

‎templates/security/login.html.twig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
{% if app.user %}
1313
<div class="mb-3">
14-
You are logged in as {{ app.user.username }}, <a href="{{ path('app_logout') }}">Logout</a>
14+
You are logged in as {{ app.user.username }}, <a href="/logout">Logout</a>
1515
</div>
1616
{% endif %}
1717

@@ -47,7 +47,7 @@
4747
</div>
4848
</form>
4949
<p class="text-gray-500 text-center">Does not have an account? <a class="font-bold"
50-
href="{{ path('register_form') }}">Register
50+
href="{{ path('register') }}">Register
5151
Now</a></p>
5252
<p class="text-gray-500 text-center mt-3">Forget your password? <a class="font-bold"
5353
href="{{ path('app_forgot_password_request') }}">Click
File renamed without changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
password:
2+
change: Change Your Password
3+
old: Old Password
4+
current: Current Password
5+
new: New Password
6+
type_new: Type your new password
7+
confirm: Confirm your new password
8+
length: Password must be 6 digit long
9+
changed_successfully: Password changed successfully
10+
enter_email: Enter your email address and we we will send you a link to reset your password.
11+
email_sent: An email has been sent that contains a link that you can click to reset your password. This link will expire in {hour} hour(s)
12+
send_email_btn: Send password reset email
13+

‎translations/messages.en.yaml‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /