document translations

This commit is contained in:
bkfox
2020-01-06 14:15:49 +01:00
parent 253045e976
commit 078a90f09a
33 changed files with 355 additions and 543 deletions

View File

@ -1,4 +1,5 @@
{% extends "admin/change_form.html" %}
{% comment %}Admin edit template to edit pages.{% endcomment %}
{% load i18n static %}
{% block submit_buttons_bottom %}

View File

@ -1,3 +1,4 @@
{% comment %}Inline block to edit playlists{% endcomment %}
{% load static i18n %}
{% with inline_admin_formset.formset.instance as playlist %}

View File

@ -1,4 +1,5 @@
{% extends "admin/base_site.html" %}
{% comment %}Admin tool displaying logs statistics{% endcomment %}
{% load i18n aircox %}

View File

@ -1,4 +1,5 @@
{% extends "aircox/page_detail.html" %}
{% comment %}Detail page for regular articles{% endcomment %}
{% load i18n %}
{% block sidebar %}
@ -6,6 +7,7 @@
{% if sidebar_object_list %}
<section>
{% comment %}Translators: in page detail sidebar{% endcomment %}
<h4 class="title is-4">{% trans "Latest news" %}</h4>
{% for object in sidebar_object_list %}

View File

@ -1,12 +1,3 @@
{% extends "aircox/page_list.html" %}
{% load i18n aircox %}
{% block title %}
{% if parent %}
{% with parent.title as parent %}
{% blocktrans %}Articles of {{ parent }}{% endblocktrans %}
{% endwith %}
{% else %}{{ block.super }}{% endif %}
{% endblock %}
{% comment %}List of articles{% endcomment %}

View File

@ -1,8 +1,12 @@
{% comment %}
Context:
Base website template. It displays various elements depending on context
variables.
Usefull context:
- cover: image cover
- site: current website
- has_filters: display filter bar (using block "filters")
- model: view model or displayed `object`'s
- sidebar_object_list: item to display in sidebar
- sidebar_url_name: url name sidebar item complete list
- sidebar_url_parent: parent page for sidebar items complete list
@ -93,6 +97,7 @@ Blocks:
{% block main %}
{% if has_filters %}
{% comment %}Translators: extra toolbar displayed on the top of page lists {% endcomment %}
<nav class="navbar toolbar"
aria-label="{% trans "list filters" %}">
{% block filters %}{% endblock %}
@ -102,6 +107,7 @@ Blocks:
</main>
{% if has_sidebar %}
{% comment %}Translators: main sidebar {% endcomment %}
<aside class="column is-one-third-desktop">
{# FIXME: block cover into sidebar one #}
{% block cover %}

View File

@ -1,27 +0,0 @@
{% load static %}
<html>
<head>
<title>Aircox</title>
<link rel="stylesheet" href="{% static 'aircox/css/layout.css' %}" type="text/css" />
</head>
<body>
<sidebar class="sidebar main-sidebar">
</sidebar>
<main>
{% block title %}
<h1>{{ title|default:"Aircox" }}</h1>
{% endblock %}
<div class="content">
{% block content %}
{% endblock %}
</div>
</main>
</body>
</html>

View File

@ -1,193 +0,0 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% load static %}
{% block title %}
{% trans "Streamer monitor" %}
{% endblock %}
{% block content %}
<style>
.actions button {
padding: 0em;
margin: 0.2em;
text-align: center;
}
.actions button img {
max-width: 2em;
max-height: 2em;
}
.sources img {
max-width: 2.5em;
max-height: 2em;
}
.float_right {
float: right;
}
.table_section_header {
font-style: italic;
}
section.station {
padding: 0.4em;
font-size: 0.9em;
}
section.station .sources {
width: 100%;
}
section.station .name {
width: 15em;
}
section.station .file {
color: #007EDF;
}
section.station .actions {
width: 4em;
text-align: right;
}
section.station .sources .current:before {
content: '▶';
color: red;
margin: 0em 1em;
}
</style>
<script>
var Monitor = {
get_token: function () {
return document.cookie.replace(/.*csrftoken=([^;]+)(;.*|$)/, '$1');
},
run: function(action, station, source) {
var params = 'station=' + station + '&&action=' + action;
if(source)
params += '&&source=' + source;
var req = new XMLHttpRequest()
req.open('POST', '{% url 'aircox.monitor' %}', false);
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.setRequestHeader("Content-length", params.length);
req.setRequestHeader("Connection", "close");
req.setRequestHeader("X-CSRFToken", this.get_token());
req.send(params);
this.update();
},
update: function(timeout) {
var req = new XMLHttpRequest()
req.open('GET', '{% url 'aircox.monitor' %}', true);
req.onreadystatechange = function() {
if(req.readyState != 4 || (req.status != 200 && req.status != 0))
return;
var doc = document.implementation.createHTMLDocument('xhr')
.documentElement;
doc.innerHTML = req.responseText;
document.getElementById('stations').innerHTML =
doc.querySelector('#stations').innerHTML;
if(timeout)
window.setTimeout(
function() { Monitor.update(timeout);}, timeout
);
};
req.send();
},
}
Monitor.update(50000);
</script>
<header>
<h1>{% trans "Streamer monitor" %}</h1>
<input type="button" onclick="Monitor.update();"
value="{% trans "refresh" %}">
</header>
<div id='stations'>
{% for station in stations %}
<section class="station">
<header>
<h2>{{ station.name }}</h2>
</header>
<table cellspacing="0" cellpadding="0" class="sources object">
<tr>
<th class="name" colspan=2>{{ station.name }}</th>
<td>
{% with station.streamer.source.name as current_source %}
{% blocktrans %}
Current source: {{ current_source }}
{% endblocktrans %}
{% endwith %}
</td>
<td class="actions">
<button onclick="Monitor.run('restart', '{{ station.name }}');">
<img src="{% static "aircox/images/redo.png" %}" alt="{% trans "restart" %}"></button>
<button onclick="Monitor.run('skip', '{{ station.name }}');">
<img src="{% static "aircox/images/playback_next.png" %}" alt="{% trans "skip" %}"></button>
</td>
</tr>
<tr class="table_section_header">
<td colspan=2>{% trans "Source" %}</td>
<td>{% trans "File" %}</td>
<td>{% trans "Actions*" %}</td>
</tr>
{% for source in station.sources %}
<tr class="source">
<td class="name">
{% if source.is_dealer %}
{% trans "Diffusions" %}
{% else %}
{{ source.name }}
{% endif %}
</td>
<td class="source_info">
{% if source.name == station.streamer.source.name %}
<img src="{% static "aircox/images/play.png" %}" alt="{% trans "current" %}">
{% endif %}
{% if source.is_dealer %}
<img src="{% static "aircox/images/calendar_month.png" %}" alt="{% trans "diffusions" %}">
{% elif not source.program.is_show %}
<img src="{% static "aircox/images/schuffle.png" %}" alt="{% trans "stream" %}">
{% endif %}
</td>
<td class="file">
{% if source.is_dealer %}
{{ source.playlist|join:"<br>" }}
{% else %}
{{ source.sound }}
{% endif %}
</td>
<td class="actions">
<button onclick="Monitor.run('restart', '{{ station.name }}', '{{ source.name }}');">
<img src="{% static "aircox/images/redo.png" %}" alt="{% trans "restart" %}"></button>
<button onclick="Monitor.run('skip', '{{ station.name }}', '{{ source.name }}');">
<img src="{% static "aircox/images/playback_next.png" %}" alt="{% trans "skip" %}"></button>
</td>
</tr>
{% endfor %}
</table>
</section>
{% endfor %}
<div class="info small">
{% blocktrans %}
*: Due to some technical issues, it might take up to 30 seconds to execute the given action.
{% endblocktrans %}
</div>
</div>
{% endblock %}

View File

@ -1,106 +0,0 @@
{% extends "admin/base_site.html" %}
{# {% extends "aircox/controllers/base_site.html" %} #}
{% load i18n %}
{% load tz %}
{% localtime on %}
{% block title %}
{% trans "Statistics of the stations" %}
{% endblock %}
{% block content %}
<header>
<h1>{% trans "Statistics of the stations" %}</h1>
{# TODO here #}
<form action="?" method="GET">
{% trans "Go to this date:" %}
<input name="day" type="number" placeholder="{% trans "day" %}"
value="{{ statistics.0.date.day }}"></input>
<input name="month" type="number" placeholder="{% trans "month" %}"
value="{{ statistics.0.date.month }}"></input>
<input name="year" type="number" placeholder="{% trans "year" %}"
value="{{ statistics.0.date.year }}"></input>
<input type="submit" value="{% trans "Show" %}">
</form>
</header>
{% for stats in statistics %}
<section class="station">
<header>
<h2>{{ stats.station.name }},
{{ stats.date|date:'l d F Y' }}</h2>
</header>
<table cellspacing="0" cellpadding="0" class="object">
<tr class="header">
<th>{% trans "Date" %}</th>
<th width="10%">{% trans "Type" %}
{# Translators "Header for statistics view" #}
<th width="50%">{% trans "Diffusion or sound played" %}
<th width="30%">{% trans "Tags" %}</th>
</tr>
{% for item in stats.items %}
<tr>
<th>{{ item.date|time:"H:i" }}</th>
<th>{{ item.type }}</th>
<th>{{ item.name }}</th>
<th>{% for tag,count in item.tags.items %}
{{ tag }}: {{ count }};
{% endfor %}</th>
</tr>
{% for track in item.tracks %}
<tr class="subdata" tags="{{ track.tags.all|join:', '}}">
<td>{{ track.date|time:"H:i" }}</td>
<td>{% trans "Track" %}</td>
<td>{{ track.artist }} -- <emph>{{ track.title }}</emph> {{ track.version }}</td>
<td>{{ track.tags.all|join:', ' }}</td>
</tr>
{% endfor %}
{% endfor %}
<tr class="bottom">
<th>{{ stats.date|date:'d/m/Y' }}</th>
<th>{% trans "Total" %}</th>
<th>
{% with stats.items|length as items_count %}
{% with stats.count as tracks_count %}
{% blocktrans %}
{{ items_count }} items, with a total of {{ tracks_count }} tracks
{% endblocktrans %}
{% endwith %}
{% endwith %}
</th>
<th>
<script>
var tracks = document.querySelectorAll('.subdata[tags]');
var tags = {}
for(var i = 0; i < tracks.length; i++) {
var tags_ = tracks[i].getAttribute('tags').split(', ');
for(var j = 0; j < tags_.length; j++) {
var tag = tags_[j];
tags[tag] = (tags[tag] || 0) + 1;
}
}
for(var tag in tags) {
document.write('<span>' + tag + ': <b>' + tags[tag] + '</b><br>');
}
</script>
</th>
<th>{% for tag, count, average in stats.tags %}
<span>{{ tag }}: <b>{{ average|floatformat }}%</b> ({{ count }})<br>
{% endfor %}
</th>
</tr>
</table>
</section>
{% endfor %}
{% endblock %}
{% endlocaltime %}

View File

@ -1,4 +1,5 @@
{% extends "aircox/page.html" %}
{% comment %}List of diffusions as a timetable{% endcomment %}
{% load i18n aircox humanize %}
{% block title %}

View File

@ -1,4 +1,5 @@
{% extends "aircox/program_base.html" %}
{% comment %}List of a show's episodes for a specific{% endcomment %}
{% load i18n %}
{% block header %}{{ block.super }}

View File

@ -1,12 +1,3 @@
{% extends "aircox/page_list.html" %}
{% load i18n aircox %}
{% block title %}
{% if parent %}
{% with parent.title as parent %}
{% blocktrans %}Episodes of {{ parent }}{% endblocktrans %}
{% endwith %}
{% else %}{{ block.super }}{% endif %}
{% endblock %}
{% comment %}List of episodes pages{% endcomment %}

View File

@ -1,4 +1,5 @@
{% extends "aircox/page.html" %}
{% comment %}List of logs for a specific date{% endcomment %}
{% load i18n humanize aircox %}
{% block title %}

View File

@ -1,6 +1,9 @@
{% extends "aircox/base.html" %}
{% load static i18n thumbnail %}
{% comment %}
Base template to display pages (list, detail, whatever). By default extend to
this one instead of "base.html"
Context:
- cover: cover image
- title: title
@ -8,6 +11,7 @@ Context:
{% endcomment %}
{% block head_title %}
{% comment %}Hack to include the page title into the <title> tag.{% endcomment %}
{% block title %}{{ title }}{% endblock %}
&mdash;
{{ station.name }}

View File

@ -1,6 +1,8 @@
{% extends "aircox/page.html" %}
{% load static i18n humanize honeypot %}
{% comment %}
Base template used to display a page
Context:
- title: title
- page: page

View File

@ -1,11 +1,15 @@
{% extends "aircox/page.html" %}
{% comment %}Display a list of pages{% endcomment %}
{% load i18n aircox %}
{% block title %}
{% if not parent %}{{ view.model|verbose_name:True|title }}
{% else %}
{% with parent.title as title %}
{% blocktrans %}Publications of {{ title }}{% endblocktrans %}
{% with model|default:"Publications"|verbose_name:true|capfirst as model %}
{% comment %}Translators: title when pages are filtered for a specific parent page, e.g.: Articles of My Incredible Show{% endcomment %}
{% blocktrans %}{{ model }} of {{ title }}{% endblocktrans %}
{% endwith %}
{% endwith %}
{% endif %}
{% endblock %}
@ -78,6 +82,7 @@
{% else %}
<a class="pagination-previous" disabled>
{% endif %}
{% comment %}Translators: Bottom of the list, "previous page"{% endcomment %}
{% trans "Previous" %}</a>
{% if page_obj.has_next %}
@ -85,6 +90,7 @@
{% else %}
<a class="pagination-next" disabled>
{% endif %}
{% comment %}Translators: Bottom of the list, "Nextpage"{% endcomment %}
{% trans "Next" %}</a>
<ul class="pagination-list">

View File

@ -1,4 +1,5 @@
{% extends "aircox/page_detail.html" %}
{% comment %}Base template used to display informations of a specific show{% endcomment %}
{% load i18n %}
{% block sidebar_title %}

View File

@ -1,4 +1,5 @@
{% extends "aircox/program_base.html" %}
{% comment %}Detail page of a show{% endcomment %}
{% load i18n %}
{% block header %}

View File

@ -1,3 +1,8 @@
{% comment %}
Header displaying informations of a program.
FIXME: consider moving into the "widgets" directory.
{% endcomment %}
{% load i18n %}
<section class="is-size-5 has-text-weight-bold">
{% for schedule in program.schedule_set.all %}

View File

@ -32,6 +32,7 @@ An empty date results to a title or a separator
name="date" value="{{ date|date:"Y-m-d" }}">
</div>
<div class="control">
{% comment %}Translators: form button to select a date{% endcomment %}
<button class="button is-primary">{% trans "Go" %}</button>
</div>
</div>

View File

@ -1,13 +1,15 @@
{% extends "aircox/widgets/page_item.html" %}
{% load i18n easy_thumbnails_tags aircox %}
{% comment %}
List item for an episode.
Context variables:
- object: episode
- diffusion: episode's diffusion
- hide_schedule: if True, do not display start time
{% endcomment %}
{% load i18n easy_thumbnails_tags aircox %}
{% block title %}
{% if not object.is_published and object.program.is_published %}
<a href="{{ object.program.get_absolute_url }}">{{ object.title }}</a>

View File

@ -1,5 +1,7 @@
{% load i18n aircox %}
{% comment %}
List item for a log, either for a logged track or diffusion (as diffusion).
Context objects:
- object: object to render
- hide_schedule: if true, hide the schedule

View File

@ -1,5 +1,7 @@
{% load i18n easy_thumbnails_tags aircox %}
{% comment %}
List item for a page
Context variables:
- object: the object to render
- render_card: render as card

View File

@ -1,11 +1,14 @@
{% load i18n %}
{% comment %}
The audio player
{% endcomment %}
{% if audio_streams %}
<br>
<div class="box is-fullwidth is-fixed-bottom is-paddingless player"
role="{% trans "player" %}"
aria-description="{% trans "audio player used to listen to the radio" %}">
aria-description="{% trans "Audio player used to listen to the radio and podcasts" %}">
<noscript>
<audio src="{{ audio_streams.0 }}" controls>
{% for stream in audio_streams %}

View File

@ -1,3 +1,7 @@
{% comment %}
List item for a podcast.
{% endcomment %}
<div class="podcast">
{% if object.embed %}
{{ object.embed|safe }}

View File

@ -1,4 +1,6 @@
{% comment %}
List item for a track
Context:
- object: track to render
{% endcomment %}