Add support for i18n and l10n

The majority of the words on the site are user-generated, but I've tried
to surround everything else with localization calls. I don't know
another language so this will have to do until someone decides to
translate it lol

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-05-07 14:19:06 -07:00
parent bce5e6cdf6
commit fe8ea04d18
5 changed files with 33 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
{% extends "board/base.html" %}
{% load post_body %}
{% load l10n %}
{% block title %}
{% with title=board.url %}
@@ -22,15 +23,21 @@
<div class="column">&nbsp;</div>
<div class="column">
<div class="row">
<h2>Create a new thread</h2>
<h2>{% localize on %}Create a new thread{% endlocalize %}</h2>
</div>
<div class="row">
<form method="post" action="{% url 'board:board_detail' url=board.url %}" enctype="multipart/form-data">
{% csrf_token %}
<table>
{{ form.as_table }}
<tr><td>&nbsp;</td><td>Max image size: {{ max_upload_size|measure_bytes }}</td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Submit" /></td></tr>
<tr>
<th>&nbsp;</th>
<td>
{% localize on %}Max image size{% endlocalize %}:
{{ max_upload_size|measure_bytes }}
</td>
</tr>
<tr><th>&nbsp;</th><td><input type="submit" value="Submit" /></td></tr>
</table>
</form>
</div>

View File

@@ -1,5 +1,6 @@
{% extends "board/base.html" %}
{% load post_body %}
{% load l10n %}
{% block title %}
{% with title=board.url %}
@@ -25,7 +26,13 @@
{% csrf_token %}
<table>
{{ form.as_table }}
<tr><td>&nbsp;</td><td><span class="post_form_image_specs">Max image size: {{ max_upload_size|measure_bytes }}</span></td></tr>
<tr>
<th>&nbsp;</th>
<td>
{% localize on %}Max image size{% endlocalize %}:
{{ max_upload_size|measure_bytes }}
</td>
</tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Submit" /></td></tr>
</table>
</form>

View File

@@ -1,10 +1,12 @@
{% load post_body %}
{% load l10n %}
<div id="p{{post.id}}">
{# Image #}
{% if post.thumbnail %}
{# Image info #}
<div class="post_image_info">
File: <a href="{{post.image.url}}" target="_blank">{{post.original_image_name}}</a>
{% localize on %}File{% endlocalize %}:
<a href="{{post.image.url}}" target="_blank">{{post.original_image_name}}</a>
({{post.image.size|measure_bytes}}, {{post.image_width}}x{{post.image_height}})
</div>
@@ -23,17 +25,19 @@
{% if post.subject %}
<span class="post_subject">{{post.subject}}</span>
{% endif %}
by <span class="post_name">{{post.name|default:"Anonymous"}}</span>
at {{post.created}}
{% localize on %}by{% endlocalize %}
<span class="post_name">{{post.name|default:"Anonymous"}}</span>
{% localize on %}at{% endlocalize %}
{{post.created}}
{% if reply_link %}
[<a href="{{post.get_absolute_url}}">Reply</a>]
[<a href="{{post.get_absolute_url}}">{% localize on %}Reply{% endlocalize %}</a>]
{% endif %}
{# "X replies elided" dialog for OPs on the board #}
{% if replies_elided > 0 %}
<br/>
<span class="replies_elided">
({{replies_elided}} replies elided, click reply to view)
({% localize on %}{{replies_elided}} replies elided, click reply to view{% endlocalize %})
</span>
{% endif %}