feat: locales

This commit is contained in:
Pascal Engélibert 2022-12-04 10:12:34 +01:00
commit 7ee817de46
Signed by: tuxmain
GPG key ID: 3504BC6D362F7DCA
11 changed files with 618 additions and 200 deletions

View file

@ -1,14 +1,14 @@
<!doctype html>
<html lang="en">
<html lang="{{ time_lang }}">
<head>
<meta charset="utf-8"/>
<title>Admin login | Comments</title>
<title>{{ tr(l=l,k="admin_login-title")|safe }}</title>
</head>
<body>
<form action="#" method="post">
<label for="login-psw">Password:</label>
<label for="login-psw">{{ tr(l=l,k="admin_login-password_prompt")|safe }}</label>
<input type="password" id="login-psw" name="psw"/><br/>
<button type="submit" name="a" value="login">Login</button>
<button type="submit" name="a" value="login">{{ tr(l=l,k="admin_login-submit_button")|safe }}</button>
</form>
</body>
</html>

View file

@ -1,8 +1,8 @@
<!doctype html>
<html lang="en">
<html lang="{{ time_lang }}">
<head>
<meta charset="utf-8"/>
<title>Comments</title>
<title>{{ tr(l=l,k="title")|safe }}</title>
</head>
<body>
{% if comments_pending %}
@ -10,15 +10,15 @@
{% for comment in comments_pending %}
<div class="comment{% if comment.needs_approval %} comment_pending{% endif %}" id="comment-{{ comment.id | safe }}">
<span class="comment-author">{{ comment.author }}</span>
<span class="comment-date">{{ comment.post_time | date(format="%F %R", locale=config.lang) }}</span>
<span class="comment-date">{{ comment.post_time | date(format="%F %R", locale=time_lang) }}</span>
{% if comment.editable %}
<a href="?edit={{ comment.id | safe }}#edit_comment-form">Edit</a>
<a href="?edit={{ comment.id | safe }}#edit_comment-form">{{ tr(l=l,k="admin-comment-edit")|safe }}</a>
{% endif %}
{% if admin and comment.needs_approval %}
<a href="?approve={{ comment.id | safe }}">Approve</a>
<a href="?approve={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-approve")|safe }}</a>
{% endif %}
{% if admin %}
<a href="?remove={{ comment.id | safe }}">Remove</a>
<a href="?remove={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-remove")|safe }}</a>
{% endif %}
<p class="comment-text">{{ comment.text }}</p>
</div>
@ -29,15 +29,15 @@
{% for comment in comments %}
<div class="comment{% if comment.needs_approval %} comment_pending{% endif %}" id="comment-{{ comment.id | safe }}">
<span class="comment-author">{{ comment.author }}</span>
<span class="comment-date">{{ comment.post_time | date(format="%F %R", locale=config.lang) }}</span>
<span class="comment-date">{{ comment.post_time | date(format="%F %R", locale=time_lang) }}</span>
{% if comment.editable %}
<a href="?edit={{ comment.id | safe }}#edit_comment-form">Edit</a>
<a href="?edit={{ comment.id | safe }}#edit_comment-form">{{ tr(l=l,k="admin-comment-edit")|safe }}</a>
{% endif %}
{% if admin and comment.needs_approval %}
<a href="?approve={{ comment.id | safe }}">Approve</a>
<a href="?approve={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-approve")|safe }}</a>
{% endif %}
{% if admin %}
<a href="?remove={{ comment.id | safe }}">Remove</a>
<a href="?remove={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-remove")|safe }}</a>
{% endif %}
<p class="comment-text">{{ comment.text }}</p>
</div>
@ -45,25 +45,25 @@
</div>
<form id="new_comment-form" action="#new_comment-form" method="post">
{% if new_comment_errors %}
<p>Whoops, the following error occurred:</p>
<p>{{ tr(l=l,k="error-list")|safe }}</p>
<ul id="new_comment-errors" class="errors">
{% for error in new_comment_errors %}
<li class="error">{{ error | safe }}</li>
{% endfor %}
</ul>
{% endif %}
<label for="new_comment-author">Your name:</label>
<label for="new_comment-author">{{ tr(l=l,k="comment_form-author")|safe }}</label>
<input type="text" id="new_comment-author" name="author" maxlength="{{ config.comment_author_max_len | safe }}"{% if new_comment_author %} value="{{ new_comment_author }}"{% endif %}/><br/>
<label for="new_comment-email">Your e-mail:</label>
<label for="new_comment-email">{{ tr(l=l,k="comment_form-email")|safe }}</label>
<input type="email" id="new_comment-email" name="email" maxlength="{{ config.comment_email_max_len | safe }}"{% if new_comment_email %} value="{{ new_comment_email }}"{% endif %}/><br/>
<label for="new_comment-text">Your comment:</label><br/>
<label for="new_comment-text">{{ tr(l=l,k="comment_form-text")|safe }}</label><br/>
<textarea id="new_comment-text" name="text" maxlength="{{ config.comment_text_max_len | safe }}">{% if new_comment_text %}{{ new_comment_text }}{% endif %}</textarea><br/>
<button type="submit" name="a" value="new_comment">Post comment</button>
<button type="submit" name="a" value="new_comment">{{ tr(l=l,k="comment_form-new_button")|safe }}</button>
</form>
{% if edit_comment %}
<form id="edit_comment-form" action="#edit_comment-form" method="post">
{% if edit_comment_errors %}
<p>Whoops, the following error occurred:</p>
<p>{{ tr(l=l,k="error-list")|safe }}</p>
<ul id="edit_comment-errors" class="errors">
{% for error in edit_comment_errors %}
<li class="error">{{ error | safe }}</li>
@ -71,13 +71,13 @@
</ul>
{% endif %}
<input type="hidden" name="id" value="{{ edit_comment | safe }}" autocomplete="off"/>
<label for="edit_comment-author">Your name:</label>
<label for="edit_comment-author">{{ tr(l=l,k="comment_form-author")|safe }}</label>
<input type="text" id="edit_comment-author" name="author" maxlength="{{ config.comment_author_max_len | safe }}"{% if edit_comment_author %} value="{{ edit_comment_author }}"{% endif %}/><br/>
<label for="edit_comment-email">Your e-mail:</label>
<label for="edit_comment-email">{{ tr(l=l,k="comment_form-email")|safe }}</label>
<input type="email" id="edit_comment-email" name="email" maxlength="{{ config.comment_email_max_len | safe }}"{% if edit_comment_email %} value="{{ edit_comment_email }}"{% endif %}/><br/>
<label for="edit_comment-text">Your comment:</label><br/>
<label for="edit_comment-text">{{ tr(l=l,k="comment_form-text")|safe }}</label><br/>
<textarea id="edit_comment-text" name="text" maxlength="{{ config.comment_text_max_len | safe }}">{% if edit_comment_text %}{{ edit_comment_text }}{% endif %}</textarea><br/>
<button type="submit" name="a" value="edit_comment">Edit comment</button>
<button type="submit" name="a" value="edit_comment">{{ tr(l=l,k="comment_form-edit_button")|safe }}</button>
</form>
{% endif %}
</body>