summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/kbn_assets/app.js9
-rw-r--r--web/kbn_templates/base.j22
-rw-r--r--web/kbn_templates/index.j27
-rw-r--r--web/kbn_templates/modem_data.j210
-rw-r--r--web/kbn_templates/modem_verbose.j22
-rw-r--r--web/kbn_templates/modems.j22
-rw-r--r--web/kbn_templates/sms.j28
7 files changed, 28 insertions, 12 deletions
diff --git a/web/kbn_assets/app.js b/web/kbn_assets/app.js
index 86504cd..0be801d 100644
--- a/web/kbn_assets/app.js
+++ b/web/kbn_assets/app.js
@@ -102,6 +102,15 @@ function removeClass(el, name) {
}
function indexInit() {
+ // language selector
+ var langSelect = document.getElementById('lang');
+ langSelect.addEventListener('change', function() {
+ var selectedLang = this.value;
+ document.cookie = "lang=" + selectedLang + ";path=/";
+ window.location.reload();
+ });
+
+ // camera blocks
var blocks = ['zones', 'list'];
for (var i = 0; i < blocks.length; i++) {
var button = ge('cam_'+blocks[i]+'_btn');
diff --git a/web/kbn_templates/base.j2 b/web/kbn_templates/base.j2
index 709d838..2ecb199 100644
--- a/web/kbn_templates/base.j2
+++ b/web/kbn_templates/base.j2
@@ -18,7 +18,7 @@
{% endmacro %}
<!doctype html>
-<html data-bs-theme="auto">
+<html lang="{{ user_lang }}" data-bs-theme="auto">
<head>
<title>{{ title }}</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
diff --git a/web/kbn_templates/index.j2 b/web/kbn_templates/index.j2
index 0a7803b..7f69823 100644
--- a/web/kbn_templates/index.j2
+++ b/web/kbn_templates/index.j2
@@ -2,6 +2,13 @@
{% block content %}
<div class="container py-4">
+ <div style="float: right">
+ <select name="lang" id="lang">
+ {% for lang in lang_enum %}
+ <option value="{{ lang.value }}"{% if lang_selected == lang %} selected="selected"{% endif %}>{{ lang.name() }}</option>
+ {% endfor %}
+ </select>
+ </div>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item active" aria-current="page">{{ "main"|lang }}</li>
diff --git a/web/kbn_templates/modem_data.j2 b/web/kbn_templates/modem_data.j2
index 7f97b77..f96a197 100644
--- a/web/kbn_templates/modem_data.j2
+++ b/web/kbn_templates/modem_data.j2
@@ -1,13 +1,13 @@
{% with level=modem_data.level %}
- <span class="text-secondary">Сигнал:</span> {% include 'signal_level.j2' %}<br>
+ <span class="text-secondary">{{ "modem_signal"|lang }}:</span> {% include 'signal_level.j2' %}<br>
{% endwith %}
-<span class="text-secondary">Тип сети:</span> <b>{{ modem_data.type }}</b><br>
+<span class="text-secondary">{{ "modem_network_type"|lang }}:</span> <b>{{ modem_data.type }}</b><br>
<span class="text-secondary">RSSI:</span> {{ modem_data.rssi }}<br/>
{% if modem_data.sinr %}
<span class="text-secondary">SINR:</span> {{ modem_data.sinr }}<br/>
{% endif %}
-<span class="text-secondary">Время соединения:</span> {{ modem_data.connected_time }}<br>
-<span class="text-secondary">Принято/передано:</span> {{ modem_data.downloaded }} / {{ modem_data.uploaded }}
+<span class="text-secondary">{{ "modem_connection_time"|lang }}:</span> {{ modem_data.connected_time }}<br>
+<span class="text-secondary">{{ "modem_tx_rx"|lang }}:</span> {{ modem_data.downloaded }} / {{ modem_data.uploaded }}
<br>
-<a href="/modems/verbose.cgi?id={{ modem }}">Подробная информация</a>
+<a href="/modems/verbose.cgi?id={{ modem }}">{{ "modem_verbose_info"|lang }}</a>
diff --git a/web/kbn_templates/modem_verbose.j2 b/web/kbn_templates/modem_verbose.j2
index 7c6c930..4514451 100644
--- a/web/kbn_templates/modem_verbose.j2
+++ b/web/kbn_templates/modem_verbose.j2
@@ -2,7 +2,7 @@
{% block content %}
{{ breadcrumbs([
- {'link': '/modems.cgi', 'text': "Модемы"},
+ {'link': '/modems.cgi', 'text': 'modems'|lang},
{'text': modem_name}
]) }}
diff --git a/web/kbn_templates/modems.j2 b/web/kbn_templates/modems.j2
index a8a420d..fee1dd3 100644
--- a/web/kbn_templates/modems.j2
+++ b/web/kbn_templates/modems.j2
@@ -4,7 +4,7 @@
{{ breadcrumbs([{'text': 'modems'|lang}]) }}
{% for modem in modems %}
-<h6 class="text-primary{% if not loop.first %} mt-4{% endif %}">{{ modems.getfullname(modem) }}</h6>
+<h6 class="text-primary{% if not loop.first %} mt-4{% endif %}">{{ (modem|lang('modems'))['full'] }}</h6>
<div id="modem_data_{{ modem }}">
{% include "loading.j2" %}
</div>
diff --git a/web/kbn_templates/sms.j2 b/web/kbn_templates/sms.j2
index cd91610..41be6fc 100644
--- a/web/kbn_templates/sms.j2
+++ b/web/kbn_templates/sms.j2
@@ -7,7 +7,7 @@
<div class="nav nav-tabs" id="nav-tab">
{% for modem in modems.keys() %}
{% if selected_modem != modem %}<a href="/sms.cgi?id={{ modem }}" class="text-decoration-none">{% endif %}
- <button class="nav-link{% if modem == selected_modem %} active{% endif %}" type="button">{{ modems.getshortname(modem) }}</button>
+ <button class="nav-link{% if modem == selected_modem %} active{% endif %}" type="button">{{ (modem|lang('modems'))['short'] }}</button>
{% if selected_modem != modem %}</a>{% endif %}
{% endfor %}
</div>
@@ -43,11 +43,11 @@
</div>
<h6 class="text-primary mt-4">
- Последние
+ {{ "sms_latest"|lang }}
{% if not is_outbox %}
- <b>входящие</b> <span class="text-black-50">|</span> <a href="/sms.cgi?id={{ selected_modem }}&amp;outbox=1">исходящие</a>
+ <b>{{ "sms_inbox"|lang }}</b> <span class="text-black-50">|</span> <a href="/sms.cgi?id={{ selected_modem }}&amp;outbox=1">{{ "sms_outbox"|lang }}</a>
{% else %}
- <a href="/sms.cgi?id={{ selected_modem }}">входящие</a> <span class="text-black-50">|</span> <b>исходящие</b>
+ <a href="/sms.cgi?id={{ selected_modem }}">{{ "sms_inbox"|lang }}</a> <span class="text-black-50">|</span> <b>{{ "sms_outbox"|lang }}</b>
{% endif %}
</h6>