Allow translating text in templates

This commit is contained in:
rubenwardy
2022-01-07 23:27:00 +00:00
parent c8b0f9e6ce
commit c5a6ae3035
60 changed files with 415 additions and 349 deletions

View File

@@ -1,7 +1,11 @@
{% extends "users/settings_base.html" %}
{% block title %}
{{ _("Account and Security | %(username)s", username=user.username) }}
{{ _("Account and Security - %(username)s", username=user.username) }}
{% endblock %}
{% block ruben_link %}
<a href="https://forum.minetest.net/ucp.php?i=pm&mode=compose&u=2051">rubenwardy</a>
{% endblock %}
{% block pane %}
@@ -37,9 +41,13 @@
<h3>{{ _("Password") }}</h3>
{% if user == current_user %}
{% if user.password %}
<a class="btn btn-primary" href="{{ url_for('users.change_password') }}">Change Password</a>
<a class="btn btn-primary" href="{{ url_for('users.change_password') }}">
{{ _("Change Password") }}
</a>
{% else %}
<a class="btn btn-primary" href="{{ url_for('users.set_password') }}">Set Password</a>
<a class="btn btn-primary" href="{{ url_for('users.set_password') }}">
{{ _("Set Password") }}
</a>
{% endif %}
{% else %}
{% if user.password %}
@@ -56,11 +64,10 @@
<td>
{% if user.forums_username %}
<a class="btn btn-secondary" href="https://forum.minetest.net/memberlist.php?mode=viewprofile&un={{ user.forums_username }}">
Connected [{{ user.forums_username }}]
{{ _("Connected") }} [{{ user.forums_username }}]
</a>
{% else %}
Please <a href="https://forum.minetest.net/ucp.php?i=pm&mode=compose&u=2051">PM rubenwardy</a>
on the forums to link your account.
{{ _("Please PM %(rubenwardy)s on the forums to link your account.", rubenwardy=self.ruben_link()) }}
{% endif %}
</td>
</tr>
@@ -69,23 +76,29 @@
<td>
{% if user.github_username %}
<a class="btn btn-secondary" href="https://github.com/{{ user.github_username }}">
Connected [{{ user.github_username }}]
{{ _("Connected") }} [{{ user.github_username }}]
</a>
{% if user == current_user %}
<a class="btn btn-secondary ml-2" href="{{ url_for('github.view_permissions') }}">View ContentDB's GitHub Permissions</a>
<a class="btn btn-secondary ml-2" href="{{ url_for('github.view_permissions') }}">
{{ _("View ContentDB's GitHub Permissions") }}
</a>
{% endif %}
{% elif user == current_user %}
<a class="btn btn-secondary" href="{{ url_for('github.start') }}">Link Github</a>
<a class="btn btn-secondary" href="{{ url_for('github.start') }}">
{{ _("Link Github") }}
</a>
{% else %}
None
{{ _("None") }}
{% endif %}
</td>
</tr>
</table>
{% if current_user.rank.atLeast(current_user.rank.MODERATOR) %}
<a class="btn btn-secondary float-right" href="{{ url_for('admin.audit', username=user.username) }}">View All</a>
<a class="btn btn-secondary float-right" href="{{ url_for('admin.audit', username=user.username) }}">
{{ _("View All") }}
</a>
{% endif %}
<h3>{{ _("Recent Account Actions") }}</h3>
@@ -96,7 +109,8 @@
<h3>{{ _("Account Deletion and Deactivation") }}</h3>
{% if current_user.rank.atLeast(current_user.rank.ADMIN) %}
<a class="btn btn-danger" href="{{ url_for('users.delete', username=user.username) }}">Delete or Deactivate</a>
<a class="btn btn-danger" href="{{ url_for('users.delete', username=user.username) }}">
{{ _("Delete or Deactivate") }}</a>
{% else %}
<p>
{{ _("Account Deletion and Deactivation isn't available to users yet.") }}

View File

@@ -8,14 +8,16 @@
{% if optional %}
<div class="alert alert-primary">
It is recommended that you set a password for your account.
{{ _("It is recommended that you set a password for your account.") }}
<a class="alert_right button" href="{{ url_for('homepage.home') }}">Skip</a>
<a class="alert_right button" href="{{ url_for('homepage.home') }}">
{{ _("Skip") }}
</a>
</div>
{% endif %}
<h1>Set Password</h1>
<h1>{{ _("Set Password") }}</h1>
{% from "macros/forms.html" import render_field, render_submit_field %}
<form action="" method="POST" class="form" role="form">
@@ -31,15 +33,12 @@
{{ render_field(form.old_password, tabindex=230) }}
{% endif %}
{{ render_field(form.password, tabindex=230) }}
{{ render_field(form.password, tabindex=230, hint=_("Must be at least 8 characters long.")) }}
{{ render_field(form.password2, tabindex=240) }}
<p>
Must be at least 8 characters long.
</p>
<p>
Password suggestion
(<a href="https://xkcd.com/936/">Why?</a>):
{{ _("Password suggestion") }}
(<a href="https://xkcd.com/936/">{{ _("Why?") }}</a>):
<code>{{ suggested_password }}</code>
</p>

View File

@@ -10,17 +10,22 @@
<h2>{{ _("Do you have an account on the Minetest Forums?") }}</h2>
<p>
ContentDB will link your account to your forum account.
{{ _("ContentDB will link your account to your forum account.") }}
</p>
<p>
You don't need a forum account, however, it's recommended to make the most
out of the Minetest community.
{{ _("You don't need a forum account, however, it's recommended to make the most out of the Minetest community.") }}
</p>
<p class="mt-5">
<a class="btn btn-primary mr-3" href="{{ url_for('users.claim_forums') }}"><b>Yes</b>, I have a forums account</a>
<a class="btn btn-primary mr-3" href="{{ url_for('users.register') }}"><b>No</b>, I don't have one</a>
<a class="btn btn-secondary" href="https://forum.minetest.net/ucp.php?mode=register">Create forum account</a>
<a class="btn btn-primary mr-3" href="{{ url_for('users.claim_forums') }}">
{{ _("<b>Yes</b>, I have a forums account") }}
</a>
<a class="btn btn-primary mr-3" href="{{ url_for('users.register') }}">
{{ _("<b>No</b>, I don't have one") }}
</a>
<a class="btn btn-secondary" href="https://forum.minetest.net/ucp.php?mode=register">
{{ _("Create forum account") }}
</a>
</p>
{% endblock %}

View File

@@ -10,21 +10,21 @@ Create Account from Forums User
<h2>{{ _("Confirm Your Account") }}</h2>
<p>
You'll need to use prove that you have access to your forum account using one of the options below.<br>
This is so ContentDB can link your account to your forum account.
{{ _("You'll need to use prove that you have access to your forum account using one of the options below.") }}<br>
{{ _("This is so ContentDB can link your account to your forum account.") }}
</p>
<p>
Don't have a forums account?
You can still <a href="{{ url_for('users.register') }}">sign up without one</a>.
{{ _("Don't have a forums account?") }}
{{ _("You can still <a href='%(url)s'>sign up without one</a>.", link=url_for('users.register')) }}
</p>
<div class="row mt-5">
<div class="col-sm-6">
<div class="card">
<div class="card-header">
<span class="badge badge-pill badge-dark mr-2">Option 1</span>
Use GitHub field in forum profile
<span class="badge badge-pill badge-dark mr-2">{{ _("Option 1") }}</span>
{{ _("Use GitHub field in forum profile") }}
</div>
<form method="post" class="card-body" action="">
@@ -32,20 +32,19 @@ Create Account from Forums User
<input class="form-control" type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<p>
Enter your forum username here:
{{ _("Enter your forum username here:") }}
</p>
<input class="form-control my-4" type="text" name="username" value="{{ username }}"
placeholder="Forum username" pattern="[a-zA-Z0-9._ -]+" title="Only a-zA-Z0-9._ allowed" required>
placeholder="{{ _('Forum username') }}" pattern="[a-zA-Z0-9._ -]+"
title="{{ _('Only a-zA-Z0-9._ allowed') }}" required>
<p>
You'll need to have the GitHub field in your forum profile
filled out. Log into the forum and
<a href="https://forum.minetest.net/ucp.php?i=173">
do that here</a>.
{{ _("You'll need to have the GitHub field in your forum profile filled out.") }}
{{ _("Log into the forum and <a href='https://forum.minetest.net/ucp.php?i=173'>do that here</a>.") }}
</p>
<input class="btn btn-primary" type="submit" value="Next: log in with GitHub">
<input class="btn btn-primary" type="submit" value="{{ _('Next: log in with GitHub') }}">
</form>
</div>
</div>
@@ -53,8 +52,8 @@ Create Account from Forums User
<div class="col-sm-6">
<div class="card">
<div class="card-header">
<span class="badge badge-pill badge-dark mr-2">Option 2</span>
Verification token
<span class="badge badge-pill badge-dark mr-2">{{ _("Option 2") }}</span>
{{ _("Verification token") }}
</div>
<form method="post" class="card-body" action="">
@@ -62,33 +61,30 @@ Create Account from Forums User
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<p>
Enter your forum username here:
{{ _("Enter your forum username here:") }}
</p>
<input class="form-control my-3" type="text" name="username" value="{{ username }}"
placeholder="Forum username" pattern="[a-zA-Z0-9._ -]+" title="Only a-zA-Z0-9._ allowed" required>
placeholder="{{ _('Forum username') }}" pattern="[a-zA-Z0-9._ -]+" title="{{ _('Only a-zA-Z0-9._ allowed') }}" required>
<p>
Go to
<a href="https://forum.minetest.net/ucp.php?i=profile&mode=signature">
User Control Panel > Profile > Edit signature
</a>
{{ _("Go to <a href="https://forum.minetest.net/ucp.php?i=profile&mode=signature">User Control Panel > Profile > Edit signature</a>") }}
</p>
<p>
Paste this into your signature:
{{ _("Paste this into your signature:") }}
</p>
<input class="form-control my-3" type="text" value="{{ key }}" readonly size=32>
<p>
Click next so we can check it.
{{ _("Click next so we can check it.") }}
</p>
<p>
Don't worry, you can remove it after this is done.
{{ _("Don't worry, you can remove it after this is done.") }}
</p>
<input class="btn btn-primary" type="submit" value="Next">
<input class="btn btn-primary" type="submit" value="{{ _('Next') }}">
</form>
</div>
</div>

View File

@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block title %}
Delete user {{ user.username }}
{{ _("Delete user %(username)s", username=user.username) }}
{% endblock %}
{% block content %}
@@ -10,7 +10,7 @@
<h3 class="card-header">{{ self.title() }}</h3>
<div class="card-body">
<p><b>Deleting is permanent</b></p>
<p><b>{{ _("Deleting is permanent") }}</b></p>
{% if can_delete %}
<p>
@@ -26,16 +26,18 @@
</p>
{% endif %}
<a class="btn btn-secondary mr-3" href="{{ url_for('users.account', username=user.username) }}">Cancel</a>
<a class="btn btn-secondary mr-3" href="{{ url_for('users.account', username=user.username) }}">
{{ _("Cancel") }}
</a>
<input type="submit"
{% if can_delete %}
name="delete" value="Delete"
name="delete" value="{{ _('Delete') }}"
{% else %}
name="deactivate" value="Deactivate"
name="deactivate" value="{{ _('Deactivate') }}"
{% endif %}
class="btn btn-danger" />
{% if not can_delete and current_user.rank.atLeast(current_user.rank.ADMIN) %}
<input type="submit" name="delete" value="Delete Anyway" class="btn btn-danger ml-3" />
<input type="submit" name="delete" value="{{ _('Delete Anyway') }}" class="btn btn-danger ml-3" />
{% endif %}
</div>
</form>

View File

@@ -1,14 +1,14 @@
{% extends "base.html" %}
{% block title %}
Request Password Reset
{{ _("Request Password Reset") }}
{% endblock %}
{% block content %}
{% from "macros/forms.html" import render_field, render_checkbox_field, render_submit_field %}
<div class="card">
<h2 class="card-header">{{ _("Request Password Reset") }}</h2>
<h2 class="card-header">{{ self.title() }}</h2>
<form action="" method="POST" class="form card-body" role="form">
{{ form.hidden_tag() }}

View File

@@ -15,7 +15,9 @@
</p>
{% if not current_user.is_authenticated %}
<a class="btn btn-primary" href="{{ url_for('users.claim_forums', username=username) }}">Claim Account</a>
<a class="btn btn-primary" href="{{ url_for('users.claim_forums', username=username) }}">
{{ _("Claim Account") }}
</a>
{% endif %}
</article>
{% endblock %}

View File

@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block title %}
Sign in
{{ _("Sign in") }}
{% endblock %}
{% block container %}
@@ -10,7 +10,7 @@
<form class="signin" method="POST">
{{ form.hidden_tag() }}
<h1 class="h3 mb-4 font-weight-normal">Sign in</h1>
<h1 class="h3 mb-4 font-weight-normal">{{ self.title() }}</h1>
{{ render_field(form.username, tabindex=110, label_visible=False, placeholder=_("Username or email")) }}
{{ render_field(form.password, tabindex=120, label_visible=False, placeholder=_("Password")) }}

View File

@@ -8,7 +8,7 @@
<article class="row mb-5">
<div class="col-auto image mx-0">
<img class="img-fluid user-photo img-thumbnail img-thumbnail-1" src="{{ user.getProfilePicURL() }}" alt="Profile picture">
<img class="img-fluid user-photo img-thumbnail img-thumbnail-1" src="{{ user.getProfilePicURL() }}" alt="{{ _('Profile picture') }}">
</div>
<div class="col">
{% if user.can_see_edit_profile(current_user) %}
@@ -117,9 +117,9 @@
{% if not current_user.is_authenticated and user.rank == user.rank.NOT_JOINED and user.forums_username %}
<div class="alert alert-secondary mb-5">
<a class="float-right btn btn-default btn-sm"
href="{{ url_for('users.claim_forums', username=user.forums_username) }}">Claim</a>
href="{{ url_for('users.claim_forums', username=user.forums_username) }}">{{ _("Claim") }}</a>
Is this you? Claim your account now!
{{ _("Is this you? Claim your account now!") }}
</div>
{% else %}
<div class="row mb-5">
@@ -166,13 +166,13 @@
<a class="float-right btn btn-sm btn-primary"
href="{{ url_for('packages.create_edit', author=user.username) }}">
<i class="fas fa-plus mr-1"></i>
Create package
{{ _("Create package") }}
</a>
{% endif %}
{% if current_user == user or (current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.EDITOR)) %}
<a class="float-right btn btn-sm btn-secondary mr-2"
href="{{ url_for('todo.tags', author=user.username) }}">
View list of tags
{{ _("View list of tags") }}
</a>
{% endif %}
<h2 class="my-3">{{ _("Packages") }}</h2>

View File

@@ -1,7 +1,7 @@
{% extends "users/settings_base.html" %}
{% block title %}
{{ _("Edit Profile | %(username)s", username=user.username) }}
{{ _("Edit Profile - %(username)s", username=user.username) }}
{% endblock %}
{% block pane %}

View File

@@ -1,14 +1,14 @@
{% extends "base.html" %}
{% block title %}
Register
{{ _("Register") }}
{% endblock %}
{% block content %}
{% from "macros/forms.html" import render_field, render_checkbox_field, render_submit_field %}
<div class="card w-50 text-left" style="margin: 2em auto;">
<h2 class="card-header">{{ _("Register") }}</h2>
<h2 class="card-header">{{ self.title() }}</h2>
<form action="" method="POST" class="form card-body" role="form">
{{ form.hidden_tag() }}
@@ -27,8 +27,8 @@ Register
{{ render_field(form.password, hint=_("Must be at least 8 characters long.")) }}
<p>
Password suggestion
(<a href="https://xkcd.com/936/">Why?</a>):
{{ _("Password suggestion") }}
(<a href="https://xkcd.com/936/">{{ _("Why?") }}</a>):
<code>{{ suggested_password }}</code>
</p>

View File

@@ -1,7 +1,7 @@
{% extends "users/settings_base.html" %}
{% block title %}
{{ _("Email and Notifications | %(username)s", username=user.username) }}
{{ _("Email and Notifications - %(username)s", username=user.username) }}
{% endblock %}
{% block pane %}
@@ -11,7 +11,7 @@
<form action="" method="POST" class="form" role="form">
{{ form.hidden_tag() }}
<h3>Email Address</h3>
<h3>{{ _("Email Address") }}</h3>
{{ render_field(form.email, tabindex=100) }}
@@ -26,7 +26,7 @@
</p>
{% endif %}
<h3>Notification Settings</h3>
<h3>{{ _("Notification Settings") }}</h3>
{% if is_new %}
<p class="alert alert-info">
@@ -35,15 +35,15 @@
{% endif %}
<p>
Configure whether certain types of notifications are sent immediately, or as part of a daily digest. <br>
{{ _("Configure whether certain types of notifications are sent immediately, or as part of a daily digest.") }}
</p>
<table class="table">
<tr>
<th>Event</th>
<th>Description</th>
<td>Immediately</td>
<td>In digest</td>
<th>{{ _("Event") }}</th>
<th>{{ _("Description") }}</th>
<td>{{ _("Immediately") }}</td>
<td>{{ _("In digest") }}</td>
</tr>
{% for type in types %}
<tr>

View File

@@ -36,28 +36,29 @@
{% if user %}
<div class="alert alert-danger">
<p>
<strong>Unsubscribing may prevent you from being able to sign into the
account '{{ user.display_name }}'</strong>.
<strong>
{{ _("Unsubscribing may prevent you from being able to sign into the account '%(display_name)s'", display_name=user.display_name) }}
</strong>.
</p>
<p class="mb-0">
ContentDB will no longer be able to send "forget password" and other essential system emails.
Consider editing your email notification preferences instead.
{{ _("ContentDB will no longer be able to send "forget password" and other essential system emails.
Consider editing your email notification preferences instead.") }}
</p>
</div>
{% else %}
<p class="alert alert-warning">
You won't be able to use this email with ContentDB anymore.
{{ _("You won't be able to use this email with ContentDB anymore.") }}
</p>
{% endif %}
<div class="button-group mt-4">
{% if user %}
<a class="btn btn-primary mr-3" href="{{ url_for('users.email_notifications', username=user.username) }}">
Edit Notification Preferences
{{ _("Edit Notification Preferences") }}
</a>
{% endif %}
<input class="btn btn-danger" type="submit" value="Unsubscribe">
<input class="btn btn-danger" type="submit" value="{{ _('Unsubscribe') }}">
</div>
</form>
{% endif %}