Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 368b6a0

Browse files
committed
Make the consent screens (almost completely) translatable
One exception is the wording for the privacy policy/TOS, because it's annoying to do with the conditionals.
1 parent a3fb983 commit 368b6a0

File tree

4 files changed

+109
-42
lines changed

4 files changed

+109
-42
lines changed

templates/pages/consent.html

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{#
2-
Copyright 2022 The Matrix.org Foundation C.I.C.
2+
Copyright 2022-2024 The Matrix.org Foundation C.I.C.
33

44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -28,20 +28,23 @@
2828
{% endif %}
2929

3030
<div class="header">
31-
<h1 class="title">Allow access to your account?</h1>
32-
<p class="text"><a target="_blank" href="{{ client.client_uri }}">{{ client_name }}</a> <span class="whitespace-nowrap">at {{ grant.redirect_uri | simplify_url }}</span> wants to access your account. This will allow <span class="whitespace-nowrap">{{ client_name }}</span> to:</p>
31+
<h1 class="title">{{ _("mas.consent.heading") }}</h1>
32+
<p class="text [&>span]:whitespace-nowrap">
33+
{{ _("mas.consent.client_wants_access", client_name=client_name, redirect_uri=(grant.redirect_uri | simplify_url)) }}
34+
{{ _("mas.consent.this_will_allow", client_name=client_name) }}
35+
</p>
3336
</div>
3437
</header>
3538

3639
<section class="consent-scope-list">
3740
{{ scope.list(scopes=grant.scope) }}
3841
</section>
3942

40-
<section class="text-center cpd-text-secondary cpd-text-body-md-regular">
41-
<span class="font-semibold cpd-text-primary">Make sure that you trust <span class="whitespace-nowrap">{{ client_name }}</span>.</span>
42-
You may be sharing sensitive information with this site or app.
43+
<section class="text-center cpd-text-secondary cpd-text-body-md-regular [&>span]:whitespace-nowrap">
44+
<strong class="font-semibold cpd-text-primary [&>span]:whitespace-nowrap">{{ _("mas.consent.make_sure_you_trust", client_name=client_name) }}</strong>
45+
{{ _("mas.consent.you_may_be_sharing") }}
4346
{% if client.policy_uri or client.tos_uri %}
44-
Find out how {{ client_name }} will handle your data by reviewing its
47+
Find out how <span>{{ client_name }}</span> will handle your data by reviewing its
4548
{% if client.policy_uri %}
4649
<a target="_blank" href="{{ client.policy_uri }}" class="cpd-link" data-kind="primary">privacy policy</a>{% if not client.tos_uri %}.{% endif %}
4750
{% endif %}

templates/pages/device_consent.html

+16-28
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{% endif %}
3131

3232
<div class="header">
33-
<h1 class="title">Allow access to your account?</h1>
33+
<h1 class="title">{{ _("mas.consent.heading") }}</h1>
3434

3535
<div class="session-card my-4">
3636
<div class="card-header" {%- if grant.user_agent %} title="{{ grant.user_agent.raw }}"{% endif %}>
@@ -72,31 +72,31 @@ <h1 class="title">Allow access to your account?</h1>
7272

7373
{# If we couldn't detect anything, show a generic "Device" #}
7474
{% if not grant.user_agent.model and not grant.user_agent.name and not grant.user_agent.os %}
75-
<div>Device</div>
75+
<div>{{ _("mas.device_card.generic_device") }}</div>
7676
{% endif %}
7777
</div>
7878
</div>
7979
<div class="metadata">
8080
{% if grant.ip_address %}
8181
<div>
82-
<div class="key">IP address</div>
82+
<div class="key">{{ _("mas.device_card.ip_address") }}</div>
8383
<div class="value">{{ grant.ip_address }}</div>
8484
</div>
8585
{% endif %}
8686
<div>
87-
<div class="key">Access requested</div>
87+
<div class="key">{{ _("mas.device_card.access_requested") }}</div>
8888
<div class="value">{{ _.relative_date(grant.created_at) | title }} {{ _.short_time(grant.created_at) }}</div>
8989
</div>
9090
<div>
91-
<div class="key">Code</div>
91+
<div class="key">{{ _("mas.device_card.device_code") }}</div>
9292
<div class="value">{{ grant.user_code }}</div>
9393
</div>
9494
</div>
9595
</div>
9696

97-
<p class="text">
98-
Another device wants to access your account.
99-
This will allow <span class="whitespace-nowrap">{{ client_name }}</span> to:
97+
<p class="text [&>span]:whitespace-nowrap">
98+
{{ _("mas.device_consent.another_device_access") }}
99+
{{ _("mas.consent.this_will_allow", client_name=client_name) }}
100100
</p>
101101
</div>
102102
</header>
@@ -105,11 +105,11 @@ <h1 class="title">Allow access to your account?</h1>
105105
{{ scope.list(scopes=grant.scope) }}
106106
</section>
107107

108-
<section class="text-center text-balance cpd-text-secondary cpd-text-body-md-regular">
109-
<span class="font-semibold cpd-text-primary">Make sure that you trust <span class="whitespace-nowrap">{{ client_name }}</span>.</span>
110-
You may be sharing sensitive information with this site or app.
108+
<section class="text-center text-balance cpd-text-secondary cpd-text-body-md-regular [&>span]:whitespace-nowrap">
109+
<strong class="font-semibold cpd-text-primary [&>span]:whitespace-nowrap">{{ _("mas.consent.make_sure_you_trust", client_name=client_name) }}</strong>
110+
{{ _("mas.consent.you_may_be_sharing") }}
111111
{% if client.policy_uri or client.tos_uri %}
112-
Find out how {{ client_name }} will handle your data by reviewing its
112+
Find out how <span>{{ client_name }}</span> will handle your data by reviewing its
113113
{% if client.policy_uri %}
114114
<a target="_blank" href="{{ client.policy_uri }}" class="cpd-link" data-kind="primary">privacy policy</a>{% if not client.tos_uri %}.{% endif %}
115115
{% endif %}
@@ -148,14 +148,8 @@ <h1 class="title">Allow access to your account?</h1>
148148
</div>
149149

150150
<div class="header">
151-
<h1 class="title">Access denied</h1>
152-
<p class="text">
153-
You denied access to
154-
{% if client.client_uri %}
155-
<a target="_blank" href="{{ client.client_uri }}">{{ client_name }}</a>
156-
{%- else %}
157-
{{ client_name -}}
158-
{% endif -%}. You can now close this window.
151+
<h1 class="title">{{ _("mas.device_consent.denied.heading") }}</h1>
152+
<p class="text">{{ _("mas.device_consent.denied.description", client_name=client_name) }}</p>
159153
</div>
160154
</header>
161155
{% else %}
@@ -165,14 +159,8 @@ <h1 class="title">Access denied</h1>
165159
</div>
166160

167161
<div class="header">
168-
<h1 class="title">Access granted</h1>
169-
<p class="text">
170-
You granted access to
171-
{% if client.client_uri %}
172-
<a target="_blank" href="{{ client.client_uri }}">{{ client_name }}</a>
173-
{%- else %}
174-
{{ client_name -}}
175-
{% endif -%}. You can now close this window.
162+
<h1 class="title">{{ _("mas.device_consent.granted.heading") }}</h1>
163+
<p class="text">{{ _("mas.device_consent.granted.description", client_name=client_name) }}</p>
176164
</div>
177165
</header>
178166
{% endif %}

templates/pages/device_link.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
</div>
2424

2525
<div class="header">
26-
<h1 class="title">Link a device</h1>
27-
<p class="text">Enter the code displayed on your device</p>
26+
<h1 class="title">{{ _("mas.device_code_link.headline") }}</h1>
27+
<p class="text">{{ _("mas.device_code_link.description") }}</p>
2828
</div>
2929
</header>
3030

translations/en.json

+81-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"action": {
33
"cancel": "Cancel",
44
"@cancel": {
5-
"context": "pages/consent.html:72:11-29, pages/device_consent.html:132:13-31, pages/login.html:100:13-31, pages/policy_violation.html:52:13-31, pages/register.html:77:13-31"
5+
"context": "pages/consent.html:75:11-29, pages/device_consent.html:132:13-31, pages/login.html:100:13-31, pages/policy_violation.html:52:13-31, pages/register.html:77:13-31"
66
},
77
"continue": "Continue",
88
"@continue": {
9-
"context": "pages/account/emails/add.html:45:26-46, pages/account/emails/verify.html:60:26-46, pages/consent.html:60:28-48, pages/device_consent.html:129:13-33, pages/device_link.html:48:26-46, pages/login.html:62:30-50, pages/reauth.html:40:28-48, pages/register.html:72:28-48, pages/sso.html:45:28-48"
9+
"context": "pages/account/emails/add.html:45:26-46, pages/account/emails/verify.html:60:26-46, pages/consent.html:63:28-48, pages/device_consent.html:129:13-33, pages/device_link.html:48:26-46, pages/login.html:62:30-50, pages/reauth.html:40:28-48, pages/register.html:72:28-48, pages/sso.html:45:28-48"
1010
},
1111
"create_account": "Create Account",
1212
"@create_account": {
@@ -18,7 +18,7 @@
1818
},
1919
"sign_out": "Sign out",
2020
"@sign_out": {
21-
"context": "pages/consent.html:68:28-48, pages/device_consent.html:141:30-50, pages/index.html:36:28-48, pages/policy_violation.html:46:28-48, pages/sso.html:53:28-48, pages/upstream_oauth2/link_mismatch.html:32:24-44, pages/upstream_oauth2/suggest_link.html:40:26-46"
21+
"context": "pages/consent.html:71:28-48, pages/device_consent.html:141:30-50, pages/index.html:36:28-48, pages/policy_violation.html:46:28-48, pages/sso.html:53:28-48, pages/upstream_oauth2/link_mismatch.html:32:24-44, pages/upstream_oauth2/suggest_link.html:40:26-46"
2222
}
2323
},
2424
"app": {
@@ -140,6 +140,82 @@
140140
"description": "Field for the user's new password"
141141
}
142142
},
143+
"consent": {
144+
"client_wants_access": "<span>%(client_name)s</span> at <span>%(redirect_uri)s</span> wants to acccess your account.",
145+
"@client_wants_access": {
146+
"context": "pages/consent.html:33:11-122"
147+
},
148+
"heading": "Allow access to your account?",
149+
"@heading": {
150+
"context": "pages/consent.html:31:27-51, pages/device_consent.html:33:29-53"
151+
},
152+
"make_sure_you_trust": "Make sure that you trust <span>%(client_name)s</span>.",
153+
"@make_sure_you_trust": {
154+
"context": "pages/consent.html:44:79-140, pages/device_consent.html:109:81-142"
155+
},
156+
"this_will_allow": "This will allow <span>%(client_name)s</span> to:",
157+
"@this_will_allow": {
158+
"context": "pages/consent.html:34:11-68, pages/device_consent.html:99:13-70"
159+
},
160+
"you_may_be_sharing": "You may be sharing sensitive information with this site or app.",
161+
"@you_may_be_sharing": {
162+
"context": "pages/consent.html:45:7-42, pages/device_consent.html:110:9-44"
163+
}
164+
},
165+
"device_card": {
166+
"access_requested": "Access requested",
167+
"@access_requested": {
168+
"context": "pages/device_consent.html:87:34-71"
169+
},
170+
"device_code": "Code",
171+
"@device_code": {
172+
"context": "pages/device_consent.html:91:34-66"
173+
},
174+
"generic_device": "Device",
175+
"@generic_device": {
176+
"context": "pages/device_consent.html:75:22-57"
177+
},
178+
"ip_address": "IP address",
179+
"@ip_address": {
180+
"context": "pages/device_consent.html:82:36-67"
181+
}
182+
},
183+
"device_code_link": {
184+
"description": "Link a device",
185+
"@description": {
186+
"context": "pages/device_link.html:27:25-62"
187+
},
188+
"headline": "Enter the code displayed on your device",
189+
"@headline": {
190+
"context": "pages/device_link.html:26:27-61"
191+
}
192+
},
193+
"device_consent": {
194+
"another_device_access": "Another device wants to access your account.",
195+
"@another_device_access": {
196+
"context": "pages/device_consent.html:98:13-58"
197+
},
198+
"denied": {
199+
"description": "You denied access to %(client_name)s. You can close this window.",
200+
"@description": {
201+
"context": "pages/device_consent.html:152:27-94"
202+
},
203+
"heading": "Access denied",
204+
"@heading": {
205+
"context": "pages/device_consent.html:151:29-67"
206+
}
207+
},
208+
"granted": {
209+
"description": "You granted access to %(client_name)s. You can close this window.",
210+
"@description": {
211+
"context": "pages/device_consent.html:163:27-95"
212+
},
213+
"heading": "Access granted",
214+
"@heading": {
215+
"context": "pages/device_consent.html:162:29-68"
216+
}
217+
}
218+
},
143219
"emails": {
144220
"greeting": "Hello %(username)s,",
145221
"@greeting": {
@@ -246,7 +322,7 @@
246322
},
247323
"not_you": "Not %(username)s?",
248324
"@not_you": {
249-
"context": "pages/consent.html:65:11-67, pages/device_consent.html:138:13-69, pages/sso.html:50:11-67",
325+
"context": "pages/consent.html:68:11-67, pages/device_consent.html:138:13-69, pages/sso.html:50:11-67",
250326
"description": "Suggestions for the user to log in as a different user"
251327
},
252328
"or_separator": "Or",
@@ -428,4 +504,4 @@
428504
}
429505
}
430506
}
431-
}
507+
}

0 commit comments

Comments
 (0)