mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2025-06-27 16:57:01 +00:00
Translation for Wireguard status page and reload/restart/export messages
This commit is contained in:
parent
e430580aba
commit
6836621b80
Binary file not shown.
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-04-14 15:34-0300\n"
|
||||
"POT-Creation-Date: 2025-04-14 16:18-0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -26,6 +26,21 @@ msgstr "Idioma"
|
||||
msgid "Change Language"
|
||||
msgstr "Alterar Idioma"
|
||||
|
||||
#: templates/access_denied.html:9
|
||||
msgid "Access Denied"
|
||||
msgstr "Acesso Negado"
|
||||
|
||||
#: templates/access_denied.html:12
|
||||
msgid "Sorry, you do not have permission to access this page."
|
||||
msgstr "Desculpe, você não tem permissão para acessar esta página."
|
||||
|
||||
#: templates/access_denied.html:12
|
||||
msgid ""
|
||||
"Please contact your system administrator if you believe this is an error."
|
||||
msgstr ""
|
||||
"Por favor, entre em contato com o administrador do sistema se você acredita "
|
||||
"que isto é um erro."
|
||||
|
||||
#: templates/accounts/login.html:14
|
||||
msgid "Username"
|
||||
msgstr "Usuário"
|
||||
@ -85,3 +100,90 @@ msgstr "Atualização Disponível"
|
||||
#: templates/base.html:288
|
||||
msgid "Version"
|
||||
msgstr "Versão"
|
||||
|
||||
#: templates/wireguard/wireguard_status.html:9
|
||||
msgid "Update Configuration"
|
||||
msgstr "Atualizar Configuração"
|
||||
|
||||
#: templates/wireguard/wireguard_status.html:16
|
||||
msgid "Restart Wireguard service"
|
||||
msgstr "Reiniciar o serviço Wireguard"
|
||||
|
||||
#: templates/wireguard/wireguard_status.html:24
|
||||
msgid "Reload Wireguard service"
|
||||
msgstr "Recarregar o serviço Wireguard"
|
||||
|
||||
#: templates/wireguard/wireguard_status.html:42
|
||||
msgid "Instance Traffic"
|
||||
msgstr "Tráfego da Instância"
|
||||
|
||||
#: templates/wireguard/wireguard_status.html:45
|
||||
msgid "IP Address"
|
||||
msgstr "Endereço IP"
|
||||
|
||||
#: templates/wireguard/wireguard_status.html:46
|
||||
msgid "Public Address"
|
||||
msgstr "Endereço Público"
|
||||
|
||||
#: templates/wireguard/wireguard_status.html:47
|
||||
msgid "Port"
|
||||
msgstr "Porta"
|
||||
|
||||
#: templates/wireguard/wireguard_status.html:48
|
||||
msgid "Peers"
|
||||
msgstr "Peers"
|
||||
|
||||
#: wireguard/views.py:96
|
||||
msgid "WireGuard Status"
|
||||
msgstr "Estado do WireGuard"
|
||||
|
||||
#: wireguard_tools/views.py:160
|
||||
msgid ""
|
||||
"Export successful!|WireGuard configuration files have been exported to /etc/"
|
||||
"wireguard/."
|
||||
msgstr ""
|
||||
"Exportação bem-sucedida!|Os arquivos de configuração do WireGuard foram "
|
||||
"exportados para /etc/wireguard/."
|
||||
|
||||
#: wireguard_tools/views.py:162
|
||||
msgid ""
|
||||
"Export successful!|WireGuard configuration files have been exported to /etc/"
|
||||
"wireguard/. Don't forget to restart the interfaces."
|
||||
msgstr ""
|
||||
"Exportação bem-sucedida!|Os arquivos de configuração do WireGuard foram "
|
||||
"exportados para /etc/wireguard/. Não se esqueça de reiniciar as interfaces."
|
||||
|
||||
#: wireguard_tools/views.py:255
|
||||
msgid "Error reloading"
|
||||
msgstr "Erro ao recarregar"
|
||||
|
||||
#: wireguard_tools/views.py:267
|
||||
msgid "Error stopping"
|
||||
msgstr "Erro ao parar"
|
||||
|
||||
#: wireguard_tools/views.py:272
|
||||
msgid "Error starting"
|
||||
msgstr "Erro ao iniciar"
|
||||
|
||||
#: wireguard_tools/views.py:279
|
||||
msgid ""
|
||||
"WARNING|Please note that the interface was reloaded, not restarted. Double-"
|
||||
"check if the the peers are working as expected. If you find any issues, "
|
||||
"please report them."
|
||||
msgstr "Aviso|Por favor, note que a interface foi recarregada, sem ser reiniciada. Verifique se os peers estão funcionando como esperado. Se você encontrar algum problema, por favor, relate-o."
|
||||
|
||||
#: wireguard_tools/views.py:280
|
||||
msgid "WireGuard reloaded|The WireGuard service has been reloaded."
|
||||
msgstr "WireGuard recarregado|O serviço WireGuard foi recarregado."
|
||||
|
||||
#: wireguard_tools/views.py:282
|
||||
msgid "WireGuard restarted|The WireGuard service has been restarted."
|
||||
msgstr "WireGuard reiniciado|O serviço WireGuard foi reiniciado."
|
||||
|
||||
#: wireguard_tools/views.py:285
|
||||
msgid "Errors encountered|Error processing one or more interfaces."
|
||||
msgstr "Erros encontrados|Erro ao processar uma ou mais interfaces."
|
||||
|
||||
#: wireguard_tools/views.py:288
|
||||
msgid "No interfaces found|No WireGuard interfaces were found to process."
|
||||
msgstr "Nenhuma interface encontrada|Nenhuma interface WireGuard foi encontrada para processar."
|
||||
|
@ -1,15 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-lg-6'>
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Access Denied</h3>
|
||||
<h3 class="card-title">{% trans 'Access Denied' %}</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>Sorry, you do not have permission to access this page. <br>Please contact your system administrator if you believe this is an error.</p>
|
||||
<p>{% trans 'Sorry, you do not have permission to access this page.' %}<br>{% trans 'Please contact your system administrator if you believe this is an error.' %}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
if (parts.length > 1) {
|
||||
$(document).Toasts('create', {
|
||||
{% if message.tags %}
|
||||
class: 'bg-{{ message.tags }}',
|
||||
class: '{% if message.tags == 'error' %}bg-danger{% else %}bg-{{ message.tags }}{% endif %}',
|
||||
{% endif %}
|
||||
title: parts[0],
|
||||
subtitle: '{{ message.tags }}',
|
||||
@ -17,7 +17,7 @@
|
||||
} else {
|
||||
$(document).Toasts('create', {
|
||||
{% if message.tags %}
|
||||
class: 'bg-{{ message.tags }}',
|
||||
class: '{% if message.tags == 'error' %}bg-danger{% else %}bg-{{ message.tags }}{% endif %}',
|
||||
{% endif %}
|
||||
subtitle: '{{ message.tags }}',
|
||||
body: parts[0],
|
||||
|
@ -1,19 +1,19 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-lg-12'>
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
<a href='/tools/export_wireguard_config/' class='btn btn-outline-primary'>Update Configuration</a>
|
||||
<a href='/tools/export_wireguard_config/' class='btn btn-outline-primary'>{% trans 'Update Configuration' %}</a>
|
||||
<a
|
||||
{% if user_acl.enable_restart %}
|
||||
href='/tools/restart_wireguard/' class='btn btn-outline-primary'
|
||||
{% else %}
|
||||
href='#' class='btn btn-outline-primary disabled'
|
||||
{% endif %}
|
||||
>Restart Wireguard service</a>
|
||||
>{% trans 'Restart Wireguard service' %}</a>
|
||||
|
||||
<a
|
||||
{% if user_acl.enable_reload %}
|
||||
@ -21,7 +21,7 @@
|
||||
{% else %}
|
||||
href='#' class='btn btn-outline-primary disabled'
|
||||
{% endif %}
|
||||
>Reload Wireguard service</a>
|
||||
>{% trans 'Reload Wireguard service' %}</a>
|
||||
|
||||
<div class="btn-group float-right" role="group" aria-label="Graph interval">
|
||||
<a href="?period=6h" data-period="6h" class="btn btn-outline-primary">6h</a>
|
||||
@ -39,13 +39,13 @@
|
||||
{% for wireguard_instance in wireguard_instances %}
|
||||
<div class="col-md-6">
|
||||
<h3>wg{{ wireguard_instance.instance_id }} {% if wireguard_instance.name %}({{ wireguard_instance.name }}){% endif %}</h3>
|
||||
<p><b><i class="fas fa-chart-area nav-icon"></i> Instance Traffic</b></p>
|
||||
<p><b><i class="fas fa-chart-area nav-icon"></i> {% trans 'Instance Traffic' %}</b></p>
|
||||
<img id="graphImg" src="/rrd/graph/?instance={{ wireguard_instance.uuid }}{% if request.GET.period %}&period={{ request.GET.period }}{% endif %}" class="img-fluid" alt="No traffic history, please wait a few minutes" onerror="this.onerror=null; this.style.display='none'; this.insertAdjacentHTML('afterend', this.alt);">
|
||||
<p>
|
||||
<b><i class="fas fa-network-wired nav-icon"></i> IP Address: </b>{{ wireguard_instance.address }}/{{ wireguard_instance.netmask }}<br>
|
||||
<b><i class="fas fa-link nav-icon"></i> Public Address: </b>{{ wireguard_instance.hostname }}<br>
|
||||
<b><i class="fas fa-door-open nav-icon"></i> Port: </b>{{ wireguard_instance.listen_port }}<br>
|
||||
<b><i class="fas fa-users-cog nav-icon"></i> Peers: </b>{{ wireguard_instance.peer_set.count }}<br>
|
||||
<b><i class="fas fa-network-wired nav-icon"></i> {% trans 'IP Address' %}: </b>{{ wireguard_instance.address }}/{{ wireguard_instance.netmask }}<br>
|
||||
<b><i class="fas fa-link nav-icon"></i> {% trans 'Public Address' %}: </b>{{ wireguard_instance.hostname }}<br>
|
||||
<b><i class="fas fa-door-open nav-icon"></i> {% trans 'Port' %}: </b>{{ wireguard_instance.listen_port }}<br>
|
||||
<b><i class="fas fa-users-cog nav-icon"></i> {% trans 'Peers' %}: </b>{{ wireguard_instance.peer_set.count }}<br>
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -4,6 +4,7 @@ from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db import models
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from user_manager.models import UserAcl
|
||||
from wireguard.forms import WireGuardInstanceForm
|
||||
@ -92,7 +93,7 @@ def legacy_view_wireguard_status(request):
|
||||
@login_required
|
||||
def view_wireguard_status(request):
|
||||
user_acl = get_object_or_404(UserAcl, user=request.user)
|
||||
page_title = 'WireGuard Status'
|
||||
page_title = _("WireGuard Status")
|
||||
|
||||
if user_acl.peer_groups.exists():
|
||||
wireguard_instances = []
|
||||
|
@ -9,6 +9,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import Http404, get_object_or_404, redirect, render
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from dns.views import export_dns_configuration
|
||||
from firewall.models import RedirectRule
|
||||
@ -156,9 +157,9 @@ def export_wireguard_configs(request):
|
||||
with open(config_path, "w") as config_file:
|
||||
config_file.write(config_content)
|
||||
if request.GET.get('action') == 'update_and_restart' or request.GET.get('action') == 'update_and_reload':
|
||||
messages.success(request, "Export successful!|WireGuard configuration files have been exported to /etc/wireguard/.")
|
||||
messages.success(request, _("Export successful!|WireGuard configuration files have been exported to /etc/wireguard/."))
|
||||
else:
|
||||
messages.success(request, "Export successful!|WireGuard configuration files have been exported to /etc/wireguard/. Don't forget to restart the interfaces.")
|
||||
messages.success(request, _("Export successful!|WireGuard configuration files have been exported to /etc/wireguard/. Don't forget to restart the interfaces."))
|
||||
if request.GET.get('action') == 'update_and_restart':
|
||||
return redirect('/tools/restart_wireguard/?action=dismiss_warning')
|
||||
elif request.GET.get('action') == 'update_and_reload':
|
||||
@ -251,7 +252,7 @@ def restart_wireguard_interfaces(request):
|
||||
os.remove(temp_config_path)
|
||||
|
||||
if result.returncode != 0:
|
||||
messages.warning(request, f"Error reloading {interface_name}|{result.stderr}")
|
||||
messages.warning(request, _('Error reloading') + f" {interface_name}|{result.stderr}")
|
||||
error_count += 1
|
||||
else:
|
||||
interface_count += 1
|
||||
@ -263,31 +264,28 @@ def restart_wireguard_interfaces(request):
|
||||
stop_command = f"wg-quick down {interface_name}"
|
||||
stop_result = subprocess.run(stop_command, shell=True, capture_output=True, text=True)
|
||||
if stop_result.returncode != 0:
|
||||
messages.warning(request, f"Error stopping {interface_name}|{stop_result.stderr}")
|
||||
messages.warning(request, _("Error stopping") + f" {interface_name}|{stop_result.stderr}")
|
||||
error_count += 1
|
||||
start_command = f"wg-quick up {interface_name}"
|
||||
start_result = subprocess.run(start_command, shell=True, capture_output=True, text=True)
|
||||
if start_result.returncode != 0:
|
||||
messages.warning(request, f"Error starting {interface_name}|{start_result.stderr}")
|
||||
messages.warning(request, _("Error starting") + f" {interface_name}|{start_result.stderr}")
|
||||
error_count += 1
|
||||
else:
|
||||
interface_count += 1
|
||||
|
||||
if interface_count > 0 and error_count == 0:
|
||||
if mode == 'reload':
|
||||
messages.warning(request, "WARNING|Please note that the interface was reloaded, not restarted. Double-check if the the peers are working as expected. If you find any issues, please report them.")
|
||||
verbose_mode = 'reloaded'
|
||||
messages.warning(request, _("WARNING|Please note that the interface was reloaded, not restarted. Double-check if the the peers are working as expected. If you find any issues, please report them."))
|
||||
messages.success(request, _("WireGuard reloaded|The WireGuard service has been reloaded."))
|
||||
else:
|
||||
verbose_mode = 'restarted'
|
||||
if interface_count == 1:
|
||||
messages.success(request, f"Interface {verbose_mode}|The WireGuard interface has been {verbose_mode}.")
|
||||
else:
|
||||
messages.success(request, f"Interfaces {verbose_mode}|{interface_count} WireGuard interfaces have been {verbose_mode}.")
|
||||
messages.success(request, _("WireGuard restarted|The WireGuard service has been restarted."))
|
||||
|
||||
elif error_count > 0:
|
||||
messages.warning(request, f"Errors encountered|There were errors {mode}ing some interfaces. See warnings for details.")
|
||||
messages.error(request, _("Errors encountered|Error processing one or more interfaces."))
|
||||
|
||||
if interface_count == 0 and error_count == 0:
|
||||
messages.info(request, f"No interfaces found|No WireGuard interfaces were found to {mode}.")
|
||||
messages.info(request, _("No interfaces found|No WireGuard interfaces were found to process."))
|
||||
if request.GET.get('action') == 'dismiss_warning':
|
||||
for wireguard_instancee in WireGuardInstance.objects.filter(pending_changes=True):
|
||||
wireguard_instancee.pending_changes = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user