1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2026-01-03 17:02:28 +03:00

templates: more translations

This commit is contained in:
Quentin Gliech
2023-10-04 18:14:40 +02:00
parent 1feafc1d13
commit ebdb8eb30e
9 changed files with 164 additions and 39 deletions

View File

@@ -15,8 +15,6 @@ limitations under the License.
#}
{# Must be kept in sync with frontend/index.html #}
{# TODO: detect the locale from the browser #}
{% set lang = "en-US" %}
<!DOCTYPE html>
<html lang="en">

View File

@@ -22,11 +22,9 @@ limitations under the License.
{% import "components/errors.html" as errors %}
{% import "components/icon.html" as icon %}
{% import "components/scope.html" as scope %}
{# TODO: detect the locale from the browser #}
{% set lang = "en-US" %}
<!DOCTYPE html>
<html>
<html lang="{{ lang }}">
<head>
<meta charset="utf-8">
<title>{% block title %}{{ _("app.name") }}{% endblock title %}</title>

View File

@@ -15,20 +15,21 @@ limitations under the License.
#}
{% macro top() %}
<!-- {{ lang }} -->
<nav class="container mx-auto py-2 flex-initial flex items-center px-8" role="navigation" aria-label="main navigation">
<div class="flex-1"></div>
<div class="grid grid-flow-col auto-cols-max gap-4 place-items-center">
{% if current_session %}
<div class="text-grey-200 dark:text-grey-250 mx-2">
Signed in as <span class="font-semibold">{{ current_session.user.username }}</span>.
{{ _("mas.navbar.signed_in_as", username=current_session.user.username) }}
</div>
{{ button.link(text="My account", href="/account/") }}
{{ logout.button(text="Sign out", csrf_token=csrf_token) }}
{{ button.link(text=_("mas.navbar.my_account"), href="/account/") }}
{{ logout.button(text=_("action.sign_out"), csrf_token=csrf_token) }}
{% else %}
{{ button.link(text="Sign in", href="/login") }}
{{ button.link_outline(text="Create an account", href="/register") }}
{{ button.link(text=_("action.sign_in"), href="/login") }}
{{ button.link_outline(text=_("mas.navbar.register"), href="/register") }}
{% endif %}
</div>
</nav>

View File

@@ -18,17 +18,17 @@ limitations under the License.
<ul>
{% for scope in (scopes | split(" ")) %}
{% if scope == "openid" %}
<li>{{ icon.user_profile() }}<p>See your profile info and contact details</p></li>
<li>{{ icon.user_profile() }}<p>{{ _("mas.scope.view_profile") }}</p></li>
{% elif scope == "urn:mas:graphql:*" %}
<li>{{ icon.info() }}<p>Edit your profile and contact details</p></li>
<li>{{ icon.computer() }}<p>Manage your devices and sessions</p></li>
<li>{{ icon.info() }}<p>{{ _("mas.scope.edit_profile") }}</p></li>
<li>{{ icon.computer() }}<p>{{ _("mas.scope.manage_sessions") }}</p></li>
{% elif scope == "urn:matrix:org.matrix.msc2967.client:api:*" %}
<li>{{ icon.chat() }}<p>View your existing messages and data</p></li>
<li>{{ icon.check_circle() }}<p>Send new messages on your behalf</p></li>
<li>{{ icon.chat() }}<p>{{ _("mas.scope.view_messages") }}</p></li>
<li>{{ icon.check_circle() }}<p>{{ _("mas.scope.send_messages") }}</p></li>
{% elif scope == "urn:synapse:admin:*" %}
<li>{{ icon.error() }}<p>Administer the Synapse homeserver</p></li>
<li>{{ icon.error() }}<p>{{ _("mas.scope.synapse_admin") }}</p></li>
{% elif scope == "urn:mas:admin" %}
<li>{{ icon.error() }}<p>Administer any user on the MAS authentication server</p></li>
<li>{{ icon.error() }}<p>{{ _("mas.scope.mas_admin") }}</p></li>
{% elif scope is starting_with("urn:matrix:org.matrix.msc2967.client:device:") %}
{# We hide this scope #}
{% else %}

View File

@@ -19,10 +19,10 @@ limitations under the License.
{% block content %}
<section class="flex-1 flex items-center justify-center">
<div class="w-64 flex flex-col gap-2">
<h1 class="text-xl font-semibold">Page not found</h1>
<p>The page you were looking for doesn't exist or has been moved</p>
<h1 class="text-xl font-semibold">{{ _("mas.not_found.heading") }}</h1>
<p>{{ _("mas.not_found.description") }}</p>
<div>
<a class="cpd-link" data-kind="primary" href="/">Go back to the homepage</a>
<a class="cpd-link" data-kind="primary" href="/">{{ _("mas.back_to_homepage") }}</a>
</div>
<hr />

View File

@@ -56,11 +56,11 @@ limitations under the License.
<form method="POST" class="flex flex-col">
<input type="hidden" name="csrf" value="{{ csrf_token }}" />
{{ button.button(text="Continue") }}
{{ button.button(text=_("action.continue")) }}
</form>
{{ back_to_client.link(
text="Cancel",
text=_("action.cancel"),
kind="tertiary",
uri=grant.redirect_uri,
mode=grant.response_mode,
@@ -68,8 +68,8 @@ limitations under the License.
) }}
<div class="text-center">
Not {{ current_session.user.username }}?
{{ logout.button(text="Sign out", csrf_token=csrf_token, post_logout_action=action, as_link=true) }}
{{ _("mas.not_you", username=current_session.user.username) }}
{{ logout.button(text=_("action.sign_out"), csrf_token=csrf_token, post_logout_action=action, as_link=true) }}
</div>
</div>
</section>

View File

@@ -20,8 +20,8 @@ limitations under the License.
<section class="flex items-center justify-center flex-1">
<form method="POST" class="grid grid-cols-1 gap-6 w-96 my-2 mx-8">
<div class="text-center">
<h1 class="text-lg text-center font-medium">Create an account</h1>
<p>Please create an account to get started:</p>
<h1 class="text-lg text-center font-medium">{{ _("mas.register.create_account.heading") }}</h1>
<p>{{ _("mas.register.create_account.description") }}</p>
</div>
{% if form.errors is not empty %}
{% for error in form.errors %}
@@ -32,31 +32,31 @@ limitations under the License.
{% endif %}
<input type="hidden" name="csrf" value="{{ csrf_token }}" />
{{ field.input(label="Username", name="username", form_state=form, autocomplete="username", autocorrect="off", autocapitalize="none") }}
{{ field.input(label="Email", name="email", type="email", form_state=form, autocomplete="email") }}
{{ field.input(label="Password", name="password", type="password", form_state=form, autocomplete="new-password") }}
{{ field.input(label="Confirm Password", name="password_confirm", type="password", form_state=form, autocomplete="new-password") }}
{{ field.input(label=_("common.username"), name="username", form_state=form, autocomplete="username", autocorrect="off", autocapitalize="none") }}
{{ field.input(label=_("common.email_address"), name="email", type="email", form_state=form, autocomplete="email") }}
{{ field.input(label=_("common.password"), name="password", type="password", form_state=form, autocomplete="new-password") }}
{{ field.input(label=_("common.password_confirm"), name="password_confirm", type="password", form_state=form, autocomplete="new-password") }}
{% if next and next.kind == "continue_authorization_grant" %}
<div class="grid grid-cols-2 gap-4">
{{ back_to_client.link(
text="Cancel",
text=_("action.cancel"),
kind="destructive",
uri=next.grant.redirect_uri,
mode=next.grant.response_mode,
params=dict(error="access_denied", state=next.grant.state)
) }}
{{ button.button(text="Next") }}
{{ button.button(text=_("action.continue")) }}
</div>
{% else %}
<div class="grid grid-cols-1 gap-4">
{{ button.button(text="Next") }}
{{ button.button(text=_("action.continue")) }}
</div>
{% endif %}
<div class="text-center mt-4">
Already have an account?
{{ _("mas.register.already_have_account") }}
{% set params = next["params"] | default({}) | to_params(prefix="?") %}
{{ button.link_text(text="Sign in instead", href="/login" ~ params) }}
{{ button.link_text(text=_("mas.register.sign_in_instead"), href="/login" ~ params) }}
</div>
</form>
</section>

View File

@@ -39,12 +39,12 @@ limitations under the License.
<form method="POST" class="flex flex-col">
<input type="hidden" name="csrf" value="{{ csrf_token }}" />
{{ button.button(text="Continue") }}
{{ button.button(text=_("action.continue")) }}
</form>
<div class="text-center">
Not {{ current_session.user.username }}?
{{ logout.button(text="Sign out", csrf_token=csrf_token, post_logout_action=action, as_link=true) }}
{{ _("mas.not_you", username=current_session.user.username) }}
{{ logout.button(text=_("action.sign_out"), csrf_token=csrf_token, post_logout_action=action, as_link=true) }}
</div>
</div>
</section>

View File

@@ -1,4 +1,22 @@
{
"action": {
"cancel": "Cancel",
"@cancel": {
"context": "pages/consent.html:63:13-31, pages/register.html:43:17-35"
},
"continue": "Continue",
"@continue": {
"context": "pages/consent.html:59:30-50, pages/register.html:49:32-52, pages/register.html:53:32-52, pages/sso.html:42:30-50"
},
"sign_in": "Sign in",
"@sign_in": {
"context": "components/navbar.html:32:28-47"
},
"sign_out": "Sign out",
"@sign_out": {
"context": "components/navbar.html:30:30-50, pages/consent.html:72:30-50, pages/sso.html:47:30-50"
}
},
"app": {
"human_name": "Matrix Authentication Service",
"@human_name": {
@@ -7,7 +25,7 @@
},
"name": "matrix-authentication-service",
"@name": {
"context": "app.html:26:14-27, base.html:32:31-44",
"context": "app.html:24:14-27, base.html:30:31-44",
"description": "Name of the application"
},
"technical_description": "OpenID Connect discovery document: <a class=\"cpd-link\" data-kind=\"primary\" href=\"%(discovery_url)s\">%(discovery_url)s</a>",
@@ -16,11 +34,121 @@
"description": "Introduction text displayed on the home page"
}
},
"common": {
"email_address": "Email address",
"@email_address": {
"context": "pages/register.html:36:27-52"
},
"password": "Password",
"@password": {
"context": "pages/register.html:37:27-47"
},
"password_confirm": "Confirm password",
"@password_confirm": {
"context": "pages/register.html:38:27-55"
},
"username": "Username",
"@username": {
"context": "pages/register.html:35:27-47"
}
},
"error": {
"unexpected": "Unexpected error",
"@unexpected": {
"context": "pages/error.html:22:41-62",
"description": "Error message displayed when an unexpected error occurs"
}
},
"mas": {
"back_to_homepage": "Go back to the homepage",
"@back_to_homepage": {
"context": "pages/404.html:25:64-89"
},
"navbar": {
"my_account": "My account",
"@my_account": {
"context": "components/navbar.html:29:28-54"
},
"register": "Create an account",
"@register": {
"context": "components/navbar.html:33:36-60"
},
"signed_in_as": "Signed in as <span class=\"font-semibold\">%(username)s</span>.",
"@signed_in_as": {
"context": "components/navbar.html:25:13-81",
"description": "Displayed in the navbar when the user is signed in"
}
},
"not_found": {
"description": "The page you were looking for doesn't exist or has been moved",
"@description": {
"context": "pages/404.html:23:14-44"
},
"heading": "Page not found",
"@heading": {
"context": "pages/404.html:22:45-71"
}
},
"not_you": "Not %(username)s?",
"@not_you": {
"context": "pages/consent.html:71:11-67, pages/sso.html:46:11-67",
"description": "Suggestions for the user to log in as a different user"
},
"register": {
"already_have_account": "Already have an account?",
"@already_have_account": {
"context": "pages/register.html:57:11-49"
},
"create_account": {
"description": "Please create an account to get started:",
"@description": {
"context": "pages/register.html:24:14-58"
},
"heading": "Create an account",
"@heading": {
"context": "pages/register.html:23:55-95"
}
},
"sign_in_instead": "Sign in instead",
"@sign_in_instead": {
"context": "pages/register.html:59:33-66"
}
},
"scope": {
"edit_profile": "Edit your profile and contact details",
"@edit_profile": {
"context": "components/scope.html:23:35-62",
"description": "Displayed when the 'urn:mas:graphql:*' scope is requested"
},
"manage_sessions": "Manage your devices and sessions",
"@manage_sessions": {
"context": "components/scope.html:24:39-69",
"description": "Displayed when the 'urn:mas:graphql:*' scope is requested"
},
"mas_admin": "Administer any user on the matrix-authentication-service",
"@mas_admin": {
"context": "components/scope.html:31:36-60",
"description": "Displayed when the 'urn:mas:admin' scope is requested"
},
"send_messages": "Send new messages on your behalf",
"@send_messages": {
"context": "components/scope.html:27:43-71"
},
"synapse_admin": "Administer the Synapse homeserver",
"@synapse_admin": {
"context": "components/scope.html:29:36-64",
"description": "Displayed when the 'urn:synapse:admin:*' scope is requested"
},
"view_messages": "View your existing messages and data",
"@view_messages": {
"context": "components/scope.html:26:35-63",
"description": "Displayed when the 'urn:matrix:client:api:*' scope is requested"
},
"view_profile": "See your profile info and contact details",
"@view_profile": {
"context": "components/scope.html:21:43-70",
"description": "Displayed when the 'openid' scope is requested"
}
}
}
}