diff --git a/README.md b/README.md index 7d5fb59..f6eb0b7 100644 --- a/README.md +++ b/README.md @@ -91,3 +91,17 @@ Django settings override environment variables with the same names. `VITE_BASE_U - **Browser cannot reach HMR:** set `VITE_DEV_SERVER_URL` to the browser-reachable Vite address, and use matching `VITE_HOST`/`VITE_PORT`. For containers or remote browsers this is often `0.0.0.0` for the host plus a public hostname for the URL. - **A page fails in development:** set `VITE_USE_DEV_SERVER=true` only while `npm run vite` or `npm run dev` is running. - **Assets return 404 after deployment:** rerun both the build and `collectstatic`; ensure the web server serves `STATIC_ROOT` at `STATIC_URL`. + +## Interface translations + +English text in templates and Python is the source language. Dutch translations live in `locale/nl/LC_MESSAGES/django.po`; the compiled `django.mo` is used at runtime. Logged-in users choose their language at `/settings/`. Visitors use the language switcher in the public navigation, which saves Django's standard language cookie. URLs and stored status or source codes do not change with the language. + +Update translations after changing user-facing source text: + +```bash +python manage.py makemessages -l nl --ignore=node_modules --ignore=staticfiles --ignore='*.orig' +# Edit locale/nl/LC_MESSAGES/django.po +python manage.py compilemessages +``` + +The small amount of JavaScript UI text is translated by Django in `templates/js_translations.html` and read from `window.BOOMCAST_I18N`. After changing JavaScript, run `npm run build` and `python manage.py collectstatic --noinput` for production. Classifier class names, API keys, sensor tokens, H3 values and stored source/status values remain language-neutral. diff --git a/fireworks_detect/__pycache__/admin.cpython-313.pyc b/fireworks_detect/__pycache__/admin.cpython-313.pyc index 19e118e..9e1ed32 100644 Binary files a/fireworks_detect/__pycache__/admin.cpython-313.pyc and b/fireworks_detect/__pycache__/admin.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/models.cpython-313.pyc b/fireworks_detect/__pycache__/models.cpython-313.pyc index f7a87c7..9591945 100644 Binary files a/fireworks_detect/__pycache__/models.cpython-313.pyc and b/fireworks_detect/__pycache__/models.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/tests.cpython-313.pyc b/fireworks_detect/__pycache__/tests.cpython-313.pyc index edd6810..460e069 100644 Binary files a/fireworks_detect/__pycache__/tests.cpython-313.pyc and b/fireworks_detect/__pycache__/tests.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/views.cpython-313.pyc b/fireworks_detect/__pycache__/views.cpython-313.pyc index d457bde..63c242c 100644 Binary files a/fireworks_detect/__pycache__/views.cpython-313.pyc and b/fireworks_detect/__pycache__/views.cpython-313.pyc differ diff --git a/fireworks_detect/admin.py b/fireworks_detect/admin.py index 6667f9b..3c63427 100644 --- a/fireworks_detect/admin.py +++ b/fireworks_detect/admin.py @@ -3,6 +3,7 @@ import json from django.contrib import admin, messages from django.utils import timezone from django.utils.html import format_html +from django.utils.translation import gettext as _, gettext_lazy, ngettext from .models import ClassificationRule, Event, PendingEvent, Sensor @@ -22,11 +23,11 @@ class ClassificationAdmin(admin.ModelAdmin): fields = ("audio_file", "sensor", "source_type", "occurrences", "location", "latitude", "longitude", "h3_cell", "direction_display", "direction_accuracy_degrees", "visually_confirmed", "original_filename", "created_at") change_form_template = "admin/fireworks_detect/classification_audio_change_form.html" - @admin.display(description="Direction") + @admin.display(description=gettext_lazy("Direction")) def direction_display(self, obj): return obj.direction_display - @admin.display(description="Classifier response") + @admin.display(description=gettext_lazy("Classifier response")) def pretty_classifier_response(self, obj): return format_html("
{}
", json.dumps(obj.classifier_response, indent=2, sort_keys=True)) @@ -38,21 +39,21 @@ class PendingEventAdmin(ClassificationAdmin): def has_add_permission(self, request): return False - @admin.action(description="Approve selected samples and move them to Events") + @admin.action(description=gettext_lazy("Approve selected samples and move them to Events")) def approve_selected(self, request, queryset): approved = 0 for pending in queryset: pending.approve() approved += 1 - self.message_user(request, f"{approved} sample(s) approved and moved to Events.", messages.SUCCESS) + self.message_user(request, ngettext("%(count)d sample approved and moved to Events.", "%(count)d samples approved and moved to Events.", approved) % {"count": approved}, messages.SUCCESS) - @admin.action(description="Deny selected samples and delete their uploaded audio") + @admin.action(description=gettext_lazy("Deny selected samples and delete their uploaded audio")) def deny_selected(self, request, queryset): denied = 0 for pending in queryset: pending.deny() denied += 1 - self.message_user(request, f"{denied} sample(s) denied and removed.", messages.WARNING) + self.message_user(request, ngettext("%(count)d sample denied and removed.", "%(count)d samples denied and removed.", denied) % {"count": denied}, messages.WARNING) @admin.register(Event) @@ -72,30 +73,30 @@ class SensorAdmin(admin.ModelAdmin): readonly_fields = ("token_prefix", "last_heartbeat", "last_submission", "created_at") actions = ("issue_api_token",) fieldsets = ( - ("Sensor", {"fields": ("name", "is_active", "created_at")}), - ("API token", {"fields": ("token_prefix",), "description": "Save the sensor first, select it in the list, then choose ‘Issue or rotate API token’. The complete token is shown once only; its salted hash is the only value stored."}), - ("Heartbeat", {"fields": ("last_heartbeat", "last_submission"), "description": "Devices should POST to /fireworks/heartbeat/ with Authorization: Bearer . Green means seen within 5 minutes; amber within 15; red is older or never seen."}), + (gettext_lazy("Sensor"), {"fields": ("name", "is_active", "created_at")}), + (gettext_lazy("API token"), {"fields": ("token_prefix",), "description": gettext_lazy("Save the sensor first, select it in the list, then choose ‘Issue or rotate API token’. The complete token is shown once only; its salted hash is the only value stored.")}), + (gettext_lazy("Heartbeat"), {"fields": ("last_heartbeat", "last_submission"), "description": gettext_lazy("Devices should POST to /fireworks/heartbeat/ with Authorization: Bearer . Green means seen within 5 minutes; amber within 15; red is older or never seen.")}), ) - @admin.display(description="Heartbeat") + @admin.display(description=gettext_lazy("Heartbeat")) def heartbeat_light(self, obj): if not obj.last_heartbeat: - colour, label = "#ef4444", "Never seen" + colour, label = "#ef4444", _("Never seen") else: age = timezone.now() - obj.last_heartbeat if age.total_seconds() <= 300: - colour, label = "#22c55e", "Online" + colour, label = "#22c55e", _("Online") elif age.total_seconds() <= 900: - colour, label = "#f59e0b", "Delayed" + colour, label = "#f59e0b", _("Delayed") else: - colour, label = "#ef4444", "Offline" + colour, label = "#ef4444", _("Offline") return format_html('{}', colour, label) - @admin.action(description="Issue or rotate API token (shown once)") + @admin.action(description=gettext_lazy("Issue or rotate API token (shown once)")) def issue_api_token(self, request, queryset): if queryset.count() != 1: - self.message_user(request, "Select exactly one sensor to issue a token.", messages.ERROR) + self.message_user(request, _("Select exactly one sensor to issue a token."), messages.ERROR) return sensor = queryset.get() token = sensor.issue_token() - self.message_user(request, format_html('Copy this token now; it is not stored and will not be shown again: {}', token), messages.WARNING) + self.message_user(request, format_html(_("Copy this token now; it is not stored and will not be shown again: {}"), token), messages.WARNING) diff --git a/fireworks_detect/models.py b/fireworks_detect/models.py index b65a4e8..9bfc094 100644 --- a/fireworks_detect/models.py +++ b/fireworks_detect/models.py @@ -6,12 +6,13 @@ from django.core.exceptions import ValidationError from django.core.files.storage import default_storage from django.db import models, transaction from django.utils import timezone +from django.utils.translation import gettext_lazy as _ class Sensor(models.Model): """A physical recorder authorised to submit audio to the device API.""" - name = models.CharField(max_length=100, unique=True, help_text="A recognisable device name, e.g. Garden ESP32.") + name = models.CharField(max_length=100, unique=True, help_text=_("A recognisable device name, e.g. Garden ESP32.")) is_active = models.BooleanField(default=True) token_prefix = models.CharField(max_length=15, blank=True, editable=False) token_hash = models.CharField(max_length=256, blank=True, editable=False) @@ -50,8 +51,8 @@ class ClassificationRule(models.Model): """A configurable inclusion or exclusion rule for a classification label.""" class RuleType(models.TextChoices): - WHITELIST = "whitelist", "Whitelist" - BLACKLIST = "blacklist", "Blacklist" + WHITELIST = "whitelist", _("Whitelist") + BLACKLIST = "blacklist", _("Blacklist") value = models.CharField(max_length=255) rule_type = models.CharField(max_length=10, choices=RuleType.choices) @@ -71,8 +72,8 @@ class ClassifiedAudio(models.Model): """Shared fields for a classifier response and its original audio upload.""" class SourceType(models.TextChoices): - SENSOR = "sensor", "Sensor" - MANUAL = "manual", "Manual report" + SENSOR = "sensor", _("Sensor") + MANUAL = "manual", _("Manual report") audio_file = models.FileField(upload_to="fireworks_audio/%Y/%m/%d", blank=True) sensor = models.ForeignKey(Sensor, null=True, blank=True, on_delete=models.SET_NULL, related_name="%(class)s_records") @@ -103,11 +104,11 @@ class ClassifiedAudio(models.Model): if self.direction_degrees is not None and ( not math.isfinite(self.direction_degrees) or not 0 <= self.direction_degrees < 360 ): - errors["direction_degrees"] = "Direction must be a finite value from 0 up to, but not including, 360 degrees." + errors["direction_degrees"] = _("Direction must be a finite value from 0 up to, but not including, 360 degrees.") if self.direction_accuracy_degrees is not None and ( not math.isfinite(self.direction_accuracy_degrees) or self.direction_accuracy_degrees < 0 ): - errors["direction_accuracy_degrees"] = "Compass accuracy must be a finite, non-negative value." + errors["direction_accuracy_degrees"] = _("Compass accuracy must be a finite, non-negative value.") if errors: raise ValidationError(errors) @@ -138,7 +139,7 @@ class ClassifiedAudio(models.Model): @property def primary_label(self): - return self.primary_prediction.get("class", "No prediction") + return self.primary_prediction.get("class", _("No prediction")) @property def primary_score(self): @@ -177,8 +178,8 @@ class PendingEvent(ClassifiedAudio): """A submitted classification awaiting a human review in Django admin.""" class Meta(ClassifiedAudio.Meta): - verbose_name = "Pending event" - verbose_name_plural = "Pending" + verbose_name = _("Pending event") + verbose_name_plural = _("Pending") @transaction.atomic def approve(self): @@ -214,5 +215,5 @@ class Event(ClassifiedAudio): approved_at = models.DateTimeField(auto_now_add=True) class Meta(ClassifiedAudio.Meta): - verbose_name = "Event" - verbose_name_plural = "Events" + verbose_name = _("Event") + verbose_name_plural = _("Events") diff --git a/fireworks_detect/templates/fireworks_detect/classification_result.html b/fireworks_detect/templates/fireworks_detect/classification_result.html index 9a1c6a1..0a7b695 100644 --- a/fireworks_detect/templates/fireworks_detect/classification_result.html +++ b/fireworks_detect/templates/fireworks_detect/classification_result.html @@ -1,32 +1,33 @@ +{% load i18n %} {% if error %} {% else %}
-

Analysis complete

+

{% trans "Analysis complete" %}

{{ result.filename|default:"Audio file" }}

- Ready + {% trans "Ready" %}
- {{ result.duration_seconds|default:"—" }} seconds - {{ result.frames_analysed|default:"—" }} frames analysed - {{ result.yamnet_sample_rate|default:"—" }} Hz model rate + {% blocktrans with duration=result.duration_seconds|default:"—" %}{{ duration }} seconds{% endblocktrans %} + {% blocktrans with frames=result.frames_analysed|default:"—" %}{{ frames }} frames analysed{% endblocktrans %} + {% blocktrans with rate=result.yamnet_sample_rate|default:"—" %}{{ rate }} Hz model rate{% endblocktrans %}
-
- {% if firework_count %}✦ {{ firework_count }} firework-related signal{{ firework_count|pluralize }}{% endif %} - {% if speech_count %}● {{ speech_count }} speech/privacy signal{{ speech_count|pluralize }}{% endif %} +
+ {% if firework_count %}✦ {% blocktrans count count=firework_count %}{{ count }} firework-related signal{% plural %}{{ count }} firework-related signals{% endblocktrans %}{% endif %} + {% if speech_count %}● {% blocktrans count count=speech_count %}{{ count }} speech/privacy signal{% plural %}{{ count }} speech/privacy signals{% endblocktrans %}{% endif %}
-

Top sound classes

+

{% trans "Top sound classes" %}

{% if predictions %}
    {% for prediction in predictions %} @@ -37,11 +38,11 @@ {% endfor %}
- {% else %}

No overall predictions were returned.

{% endif %} + {% else %}

{% trans "No overall predictions were returned." %}

{% endif %}
-

Notable moments

+

{% trans "Notable moments" %}

{% if peak_predictions %}
{% for prediction in peak_predictions %} @@ -55,14 +56,14 @@ {% endfor %}
- {% else %}

No peak events were returned.

{% endif %} + {% else %}

{% trans "No peak events were returned." %}

{% endif %}
{% if submission_token %}
-
Submit this sample for review

The audio and signed classifier response will be added to Pending.

- +
{% trans "Submit this sample for review" %}

{% trans "The audio and signed classifier response will be added to Pending." %}

+
{% endif %}
diff --git a/fireworks_detect/templates/fireworks_detect/dashboard.html b/fireworks_detect/templates/fireworks_detect/dashboard.html index 37566c8..ea24bc0 100644 --- a/fireworks_detect/templates/fireworks_detect/dashboard.html +++ b/fireworks_detect/templates/fireworks_detect/dashboard.html @@ -1,26 +1,27 @@ -{% load vite %} +{% load i18n vite %} - + - Report fireworks · Sound Signal + {% trans "Report fireworks · Sound Signal" %} {% vite_asset "frontend/src/entries/dashboard.js" %} + {% include "js_translations.html" %} - {% if user.is_authenticated %}{{ user.get_username|first|upper }}{% endif %} + {% if user.is_authenticated %}{{ user.get_username|first|upper }}{% endif %}
{% include "fireworks_detect/includes/navigation.html" %}
-

Community reporting

-

Report what you heard.

-

Quickly log fireworks when they happen. Your optional location is represented as an H3 cell on the map, rather than as precise coordinates.

+

{% trans "Community reporting" %}

+

{% trans "Report what you heard." %}

+

{% trans "Quickly log fireworks when they happen. Your optional location is represented as an H3 cell on the map, rather than as precise coordinates." %}

-
+
{% include "fireworks_detect/includes/manual_report_form.html" %}
@@ -28,15 +29,15 @@
-

Recent reports

Activity map

- Open map controls +

{% trans "Recent reports" %}

{% trans "Activity map" %}

+ {% trans "Open map controls" %}
{% include "fireworks_detect/includes/map_panel.html" %}
-

Audio analysis

Classify a recording

+

{% trans "Audio analysis" %}

{% trans "Classify a recording" %}

{% include "fireworks_detect/includes/audio_upload_form.html" %} diff --git a/fireworks_detect/templates/fireworks_detect/event_detail.html b/fireworks_detect/templates/fireworks_detect/event_detail.html index be61e06..c62cafb 100644 --- a/fireworks_detect/templates/fireworks_detect/event_detail.html +++ b/fireworks_detect/templates/fireworks_detect/event_detail.html @@ -1,27 +1,28 @@ +{% load i18n %} {% if event.source_type == "manual" %} -

Manual fireworks report

-

Approved {{ event.approved_at|date:"j M Y, H:i" }} · Reported manually

-

Report details

-
Occurrences{{ event.occurrences }}
-
Location{{ event.location|default:"Not recorded" }}
-
Captured location{{ event_h3_cell|default:"Not recorded" }}
-
Direction{{ event.direction_display }}
-{% if event.direction_accuracy_degrees is not None %}
Compass accuracy±{{ event.direction_accuracy_degrees|floatformat:"-1" }}°
{% endif %} -
Visually confirmed{% if event.visually_confirmed %}Yes{% else %}No{% endif %}
-

This was a manual report; there is no audio classification attached.

+

{% trans "Manual fireworks report" %}

+

{% blocktrans with date=event.approved_at|date:"j M Y, H:i" %}Approved {{ date }} · Reported manually{% endblocktrans %}

+

{% trans "Report details" %}

+
{% trans "Occurrences" %}{{ event.occurrences }}
+
{% trans "Location" %}{{ event.location|default:"Not recorded" }}
+
{% trans "Captured location" %}{{ event_h3_cell|default:"Not recorded" }}
+
{% trans "Direction" %}{{ event.direction_display }}
+{% if event.direction_accuracy_degrees is not None %}
{% trans "Compass accuracy" %}±{{ event.direction_accuracy_degrees|floatformat:"-1" }}°
{% endif %} +
{% trans "Visually confirmed" %}{% if event.visually_confirmed %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}
+

{% trans "This was a manual report; there is no audio classification attached." %}

{% else %}

{{ event.original_filename }}

-

Approved {{ event.approved_at|date:"j M Y, H:i" }} · {{ result.duration_seconds|default:"—" }} seconds · {{ result.frames_analysed|default:"—" }} frames

-

Top sound classes

+

{% blocktrans with date=event.approved_at|date:"j M Y, H:i" duration=result.duration_seconds|default:"—" frames=result.frames_analysed|default:"—" %}Approved {{ date }} · {{ duration }} seconds · {{ frames }} frames{% endblocktrans %}

+

{% trans "Top sound classes" %}

{% for prediction in predictions %}
{{ prediction.label }}{{ prediction.score_display }}
{% empty %} -

No predictions returned.

+

{% trans "No predictions returned." %}

{% endfor %} -

Notable moments

+

{% trans "Notable moments" %}

{% for prediction in peak_predictions %}
{{ prediction.label }}{{ prediction.time_seconds|default:"—" }}s · {{ prediction.score_display }}
{% empty %} -

No peak events returned.

+

{% trans "No peak events returned." %}

{% endfor %} {% endif %} diff --git a/fireworks_detect/templates/fireworks_detect/events.html b/fireworks_detect/templates/fireworks_detect/events.html index f832d0c..7afee08 100644 --- a/fireworks_detect/templates/fireworks_detect/events.html +++ b/fireworks_detect/templates/fireworks_detect/events.html @@ -1,2 +1,2 @@ -{% load vite %} -Events · Sound Signal{% vite_asset "frontend/src/entries/events.js" %}
{% include "fireworks_detect/includes/navigation.html" with active_page="events" %}

Reviewed signal archive

Approved events.

This feed refreshes automatically every three seconds after a pending sample is approved in admin.

Latest events

Loading events…

Select an event

Choose an approved event to inspect its classification details.

+{% load i18n vite %} +{% trans "Events · Sound Signal" %}{% vite_asset "frontend/src/entries/events.js" %}{% include "js_translations.html" %}
{% include "fireworks_detect/includes/navigation.html" with active_page="events" %}

{% trans "Reviewed signal archive" %}

{% trans "Approved events." %}

{% trans "This feed refreshes automatically every three seconds after a pending sample is approved in admin." %}

{% trans "Latest events" %}

{% trans "Loading events…" %}

{% trans "Select an event" %}

{% trans "Choose an approved event to inspect its classification details." %}

diff --git a/fireworks_detect/templates/fireworks_detect/events_list.html b/fireworks_detect/templates/fireworks_detect/events_list.html index 33af322..d61dde4 100644 --- a/fireworks_detect/templates/fireworks_detect/events_list.html +++ b/fireworks_detect/templates/fireworks_detect/events_list.html @@ -1,20 +1,21 @@ +{% load i18n %} {% if events %} {% for event in events %} {% endfor %} {% else %} -

No approved events yet. Submit a classification, then approve it from the Pending page in admin.

+

{% trans "No approved events yet. Submit a classification, then approve it from the Pending page in admin." %}

{% endif %} diff --git a/fireworks_detect/templates/fireworks_detect/home.html b/fireworks_detect/templates/fireworks_detect/home.html index c0f8aa7..ac798b8 100644 --- a/fireworks_detect/templates/fireworks_detect/home.html +++ b/fireworks_detect/templates/fireworks_detect/home.html @@ -1,13 +1,14 @@ -{% load vite %} +{% load i18n vite %} - + - Sound Signal · Fireworks detection + {% trans "Sound Signal · Fireworks detection" %} {% vite_asset "frontend/src/entries/fireworks-home.js" %} + {% include "js_translations.html" %} @@ -16,16 +17,14 @@
-

Audio event analysis

-

See what your audio heard.

-

Drop a recording to identify its most likely sounds. Firework-related signals are - highlighted in amber; speech-related signals are marked in red for future privacy filtering.

- Here's some - samples to test with +

{% trans "Audio event analysis" %}

+

{% trans "See what your audio heard." %}

+

{% blocktrans trimmed %}Drop a recording to identify its most likely sounds. Firework-related signals are highlighted in amber; speech-related signals are marked in red for future privacy filtering.{% endblocktrans %}

+ {% trans "Here are some samples to test with" %}

-
+
{% include "fireworks_detect/includes/audio_upload_form.html" %}
diff --git a/fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html b/fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html index 5bf444a..aa67a90 100644 --- a/fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html +++ b/fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html @@ -1,18 +1,19 @@ +{% load i18n %}
{% csrf_token %} -
+

diff --git a/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html b/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html index 7fd2733..f0574b2 100644 --- a/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html +++ b/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html @@ -1,22 +1,23 @@ +{% load i18n %}
-

No recording needed

-

Report fireworks now

-

Choose how many times you heard fireworks, then send it straight to Pending. The report is timestamped now.

+

{% trans "No recording needed" %}

+

{% trans "Report fireworks now" %}

+

{% trans "Choose how many times you heard fireworks, then send it straight to Pending. The report is timestamped now." %}

{% csrf_token %} - + - +
diff --git a/fireworks_detect/templates/fireworks_detect/includes/map_panel.html b/fireworks_detect/templates/fireworks_detect/includes/map_panel.html index b15c241..6c37702 100644 --- a/fireworks_detect/templates/fireworks_detect/includes/map_panel.html +++ b/fireworks_detect/templates/fireworks_detect/includes/map_panel.html @@ -1,7 +1,8 @@ -
-
Manual reports · privacy-preserving H3 cells H3 resolution {{ h3_resolution }} · sensor layer disabled
-
- +{% load i18n %} +
+
{% trans "Manual reports · privacy-preserving H3 cells" %} {% blocktrans with resolution=h3_resolution %}H3 resolution {{ resolution }} · sensor layer disabled{% endblocktrans %}
+
+
{{ h3_cells|json_script:"h3-cells-data" }} diff --git a/fireworks_detect/templates/fireworks_detect/includes/navigation.html b/fireworks_detect/templates/fireworks_detect/includes/navigation.html index 6e06561..3ddffda 100644 --- a/fireworks_detect/templates/fireworks_detect/includes/navigation.html +++ b/fireworks_detect/templates/fireworks_detect/includes/navigation.html @@ -1,11 +1,24 @@ +{% load i18n %}
✦ Sound Signal
-
diff --git a/fireworks_detect/templates/fireworks_detect/manual_pending_submission.html b/fireworks_detect/templates/fireworks_detect/manual_pending_submission.html index 840b578..f45ea87 100644 --- a/fireworks_detect/templates/fireworks_detect/manual_pending_submission.html +++ b/fireworks_detect/templates/fireworks_detect/manual_pending_submission.html @@ -1,7 +1,8 @@ +{% load i18n %}
{% if error %} - Could not report fireworks

{{ error }}

+ {% trans "Could not report fireworks" %}

{{ error }}

{% else %} - Report sent to Pending

{{ pending.occurrences }} occurrence{{ pending.occurrences|pluralize }} reported at {{ pending.created_at|date:"H:i" }}.

+ {% trans "Report sent to Pending" %}

{% blocktrans count count=pending.occurrences with time=pending.created_at|date:"H:i" %}{{ count }} occurrence reported at {{ time }}.{% plural %}{{ count }} occurrences reported at {{ time }}.{% endblocktrans %}

{% endif %}
diff --git a/fireworks_detect/templates/fireworks_detect/map.html b/fireworks_detect/templates/fireworks_detect/map.html index 1ab0a00..fd60c30 100644 --- a/fireworks_detect/templates/fireworks_detect/map.html +++ b/fireworks_detect/templates/fireworks_detect/map.html @@ -1,30 +1,31 @@ -{% load vite %} +{% load i18n vite %} - + - Signal map · Sound Signal + {% trans "Signal map · Sound Signal" %} {% vite_asset "frontend/src/entries/map.js" %} + {% include "js_translations.html" %}
{% include "fireworks_detect/includes/navigation.html" with active_page="map" %}
-

Manual report intelligence

Sound activity map.

-

Reviewed manual reports with a captured location appear as their H3 cell, not their precise coordinates. Saved phone compass readings show the reported direction of the sound.

+

{% trans "Manual report intelligence" %}

{% trans "Sound activity map." %}

+

{% trans "Reviewed manual reports with a captured location appear as their H3 cell, not their precise coordinates. Saved phone compass readings show the reported direction of the sound." %}

-
-
-
-
-
-
- - {{ mapped_event_count }} report{{ mapped_event_count|pluralize }} + +
+
+
+
+
+ + {% blocktrans count count=mapped_event_count %}{{ count }} report{% plural %}{{ count }} reports{% endblocktrans %}
{% include "fireworks_detect/includes/map_panel.html" %} diff --git a/fireworks_detect/templates/fireworks_detect/pending_submission.html b/fireworks_detect/templates/fireworks_detect/pending_submission.html index 49bd0fa..7bd9314 100644 --- a/fireworks_detect/templates/fireworks_detect/pending_submission.html +++ b/fireworks_detect/templates/fireworks_detect/pending_submission.html @@ -1,3 +1,4 @@ +{% load i18n %}
-{% if error %}
Could not submit this sample

{{ error }}

{% else %}
Sent to Pending

{{ pending.original_filename }} is ready for administrator review.

View events{% endif %} +{% if error %}
{% trans "Could not submit this sample" %}

{{ error }}

{% else %}
{% trans "Sent to Pending" %}

{% blocktrans with filename=pending.original_filename %}{{ filename }} is ready for administrator review.{% endblocktrans %}

{% trans "View events" %}{% endif %}
diff --git a/fireworks_detect/templates/home.html b/fireworks_detect/templates/home.html index ae2d249..024ba9b 100644 --- a/fireworks_detect/templates/home.html +++ b/fireworks_detect/templates/home.html @@ -1,10 +1,10 @@ -{% load vite %} +{% load i18n vite %} - + - Sound Signal · Fireworks detection + {% trans "Sound Signal · Fireworks detection" %} {% vite_asset "frontend/src/entries/legacy-fireworks-home.js" %} @@ -12,32 +12,32 @@
✦ Sound Signal
-

Audio event analysis

-

See what your audio heard.

-

Drop a recording to identify its most likely sounds. Firework-related signals are highlighted in amber; speech-related signals are marked in red for future privacy filtering.

+

{% trans "Audio event analysis" %}

+

{% trans "See what your audio heard." %}

+

{% trans "Drop a recording to identify its most likely sounds. Firework-related signals are highlighted in amber; speech-related signals are marked in red for future privacy filtering." %}

-
+
{% csrf_token %}

-
+
diff --git a/fireworks_detect/tests.py b/fireworks_detect/tests.py index 8f88313..9b2ddb3 100644 --- a/fireworks_detect/tests.py +++ b/fireworks_detect/tests.py @@ -45,6 +45,9 @@ class ClassificationRuleApiTests(TestCase): class ManualPendingEventTests(TestCase): + def setUp(self): + self.client.cookies["django_language"] = "en" + def test_manual_report_creates_a_timestamped_pending_event(self): response = self.client.post(reverse("fireworks_detect:submit_manual_pending"), { "occurrences": "4", @@ -128,8 +131,8 @@ class ManualPendingEventTests(TestCase): response = self.client.get(reverse("old_home")) self.assertEqual(response.status_code, 200) - self.assertContains(response, "Welkom Joren") - self.assertContains(response, "Open vuurwerk detector") + self.assertContains(response, "Welcome Joren") + self.assertContains(response, "Open fireworks detector") def test_manual_event_appears_in_the_normal_event_list_with_its_details(self): event = Event.objects.create( diff --git a/fireworks_detect/views.py b/fireworks_detect/views.py index 25e29c0..f0d1223 100644 --- a/fireworks_detect/views.py +++ b/fireworks_detect/views.py @@ -14,6 +14,7 @@ from django.core import signing from django.shortcuts import get_object_or_404, redirect, render from django.utils import timezone from django.utils.dateparse import parse_date +from django.utils.translation import gettext as _ from django.views.decorators.cache import never_cache from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_http_methods @@ -239,13 +240,13 @@ def classify_upload(request): uploaded_file = request.FILES.get("audio") if not uploaded_file: - return _render_error(request, "Choose an audio file before starting the analysis.") + return _render_error(request, _("Choose an audio file before starting the analysis.")) extension = Path(uploaded_file.name).suffix.lower() if not (uploaded_file.content_type or "").startswith("audio/") and extension not in AUDIO_EXTENSIONS: - return _render_error(request, "Please upload a supported audio file (such as WAV, MP3, M4A, or OGG).") + return _render_error(request, _("Please upload a supported audio file (such as WAV, MP3, M4A, or OGG).")) if uploaded_file.size > MAX_AUDIO_SIZE: - return _render_error(request, "This demo accepts audio files up to 25 MiB.") + return _render_error(request, _("This demo accepts audio files up to 25 MiB.")) body, content_type = _encode_audio_multipart(uploaded_file) classifier_request = Request( @@ -259,14 +260,14 @@ def classify_upload(request): with urlopen(classifier_request, timeout=60) as response: payload = json.loads(response.read().decode("utf-8")) except HTTPError as error: - return _render_error(request, f"The classifier returned an error (HTTP {error.code}).", status=502) + return _render_error(request, _("The classifier returned an error (HTTP %(code)s).") % {"code": error.code}, status=502) except (URLError, TimeoutError): - return _render_error(request, "The classifier could not be reached. Please try again shortly.", status=502) + return _render_error(request, _("The classifier could not be reached. Please try again shortly."), status=502) except json.JSONDecodeError: - return _render_error(request, "The classifier returned an unreadable response.", status=502) + return _render_error(request, _("The classifier returned an unreadable response."), status=502) if not isinstance(payload, dict): - return _render_error(request, "The classifier returned an unexpected response.", status=502) + return _render_error(request, _("The classifier returned an unexpected response."), status=502) # Keep the raw payload in this request flow; this is the future hand-off point # for saving the upload and its classification to a database or queue. @@ -281,17 +282,17 @@ def submit_pending_event(request): uploaded_file = request.FILES.get("audio") token = request.POST.get("classification_token") if not uploaded_file: - return render(request, "fireworks_detect/pending_submission.html", {"error": "Keep the analysed audio file selected before submitting it for review."}, status=400) + return render(request, "fireworks_detect/pending_submission.html", {"error": _("Keep the analysed audio file selected before submitting it for review.")}, status=400) if not token: - return render(request, "fireworks_detect/pending_submission.html", {"error": "Analyse the file before submitting it for review."}, status=400) + return render(request, "fireworks_detect/pending_submission.html", {"error": _("Analyse the file before submitting it for review.")}, status=400) try: payload = signing.loads(token, salt="fireworks_detect.classification", max_age=60 * 60) except signing.BadSignature: - return render(request, "fireworks_detect/pending_submission.html", {"error": "This analysis has expired. Please analyse the audio again."}, status=400) + return render(request, "fireworks_detect/pending_submission.html", {"error": _("This analysis has expired. Please analyse the audio again.")}, status=400) if not isinstance(payload, dict): - return render(request, "fireworks_detect/pending_submission.html", {"error": "The saved analysis is not valid."}, status=400) + return render(request, "fireworks_detect/pending_submission.html", {"error": _("The saved analysis is not valid.")}, status=400) pending = PendingEvent.objects.create( audio_file=uploaded_file, @@ -341,7 +342,7 @@ def submit_manual_pending_event(request): return render( request, "fireworks_detect/manual_pending_submission.html", - {"error": "Choose between 1 and 1,000 occurrences."}, + {"error": _("Choose between 1 and 1,000 occurrences.")}, status=400, ) @@ -379,7 +380,7 @@ def event_detail(request, event_id): def _audio_response(record): if not record.audio_file: - raise Http404("No audio is attached to this record.") + raise Http404(_("No audio is attached to this record.")) content_type = mimetypes.guess_type(record.audio_file.name)[0] or "application/octet-stream" return FileResponse(record.audio_file.open("rb"), content_type=content_type) diff --git a/frontend/src/scripts/admin-audio-preview.js b/frontend/src/scripts/admin-audio-preview.js index bbfb155..95d7e82 100644 --- a/frontend/src/scripts/admin-audio-preview.js +++ b/frontend/src/scripts/admin-audio-preview.js @@ -1 +1,2 @@ -document.querySelectorAll('.audio-preview').forEach(function(box){var button=box.querySelector('.audio-play'),audio=box.querySelector('audio'),label=box.querySelector('.audio-play__label'),status=box.querySelector('.audio-status');button.addEventListener('click',function(){if(!audio.src){audio.src=button.dataset.audioUrl;button.classList.add('is-loading');status.textContent='Loading recording…';}if(audio.paused){audio.play().catch(function(){button.classList.remove('is-loading');status.textContent='Could not play this recording.';});}else{audio.pause();}});audio.addEventListener('playing',function(){button.classList.remove('is-loading');label.textContent='Pause recording';status.textContent='Playing now';});audio.addEventListener('pause',function(){if(!audio.ended){label.textContent='Resume recording';status.textContent='Paused';}});audio.addEventListener('ended',function(){label.textContent='Replay recording';status.textContent='Finished';});audio.addEventListener('waiting',function(){button.classList.add('is-loading');status.textContent='Buffering…';});audio.addEventListener('canplay',function(){button.classList.remove('is-loading');});audio.addEventListener('error',function(){button.classList.remove('is-loading');status.textContent='Could not load this recording.';});}); \ No newline at end of file +const t = window.BOOMCAST_I18N || {}; +document.querySelectorAll('.audio-preview').forEach(function(box){var button=box.querySelector('.audio-play'),audio=box.querySelector('audio'),label=box.querySelector('.audio-play__label'),status=box.querySelector('.audio-status');button.addEventListener('click',function(){if(!audio.src){audio.src=button.dataset.audioUrl;button.classList.add('is-loading');status.textContent=(t.loadingRecording || 'Loading recording…');}if(audio.paused){audio.play().catch(function(){button.classList.remove('is-loading');status.textContent=(t.couldNotPlay || 'Could not play this recording.');});}else{audio.pause();}});audio.addEventListener('playing',function(){button.classList.remove('is-loading');label.textContent=(t.pauseRecording || 'Pause recording');status.textContent=(t.playingNow || 'Playing now');});audio.addEventListener('pause',function(){if(!audio.ended){label.textContent=(t.resumeRecording || 'Resume recording');status.textContent=(t.paused || 'Paused');}});audio.addEventListener('ended',function(){label.textContent=(t.replayRecording || 'Replay recording');status.textContent=(t.finished || 'Finished');});audio.addEventListener('waiting',function(){button.classList.add('is-loading');status.textContent=(t.buffering || 'Buffering…');});audio.addEventListener('canplay',function(){button.classList.remove('is-loading');});audio.addEventListener('error',function(){button.classList.remove('is-loading');status.textContent=(t.couldNotLoad || 'Could not load this recording.');});}); \ No newline at end of file diff --git a/frontend/src/scripts/audio-upload.js b/frontend/src/scripts/audio-upload.js index 946b408..45c8b32 100644 --- a/frontend/src/scripts/audio-upload.js +++ b/frontend/src/scripts/audio-upload.js @@ -1,18 +1,19 @@ + const t = window.BOOMCAST_I18N || {}; const form = document.querySelector('.upload-form'); const dropZone = document.querySelector('#drop-zone'); const fileInput = document.querySelector('#audio-file'); const fileName = document.querySelector('#file-name'); const status = document.querySelector('#upload-status'); - const showFile = (file) => { fileName.textContent = file ? file.name : 'No file selected'; }; + const showFile = (file) => { fileName.textContent = file ? file.name : (t.noFile || 'No file selected'); }; fileInput.addEventListener('change', () => showFile(fileInput.files[0])); ['dragenter', 'dragover'].forEach((eventName) => dropZone.addEventListener(eventName, (event) => { event.preventDefault(); dropZone.classList.add('dragging'); })); ['dragleave', 'drop'].forEach((eventName) => dropZone.addEventListener(eventName, (event) => { event.preventDefault(); dropZone.classList.remove('dragging'); })); dropZone.addEventListener('drop', (event) => { const [file] = event.dataTransfer.files; if (!file) return; fileInput.files = event.dataTransfer.files; showFile(file); }); - form.addEventListener('htmx:beforeRequest', () => { status.textContent = 'Analysing your recording…'; form.setAttribute('aria-busy', 'true'); }); + form.addEventListener('htmx:beforeRequest', () => { status.textContent = (t.analysing || 'Analysing your recording…'); form.setAttribute('aria-busy', 'true'); }); form.addEventListener('htmx:afterRequest', () => { status.textContent = ''; form.removeAttribute('aria-busy'); }); - form.addEventListener('htmx:responseError', () => { status.textContent = 'Analysis could not be completed.'; }); + form.addEventListener('htmx:responseError', () => { status.textContent = (t.analysisFailed || 'Analysis could not be completed.'); }); document.body.addEventListener('htmx:beforeSwap', (event) => { if (event.detail.xhr.status >= 400) { event.detail.shouldSwap = true; diff --git a/frontend/src/scripts/event-map.js b/frontend/src/scripts/event-map.js index 3b339e7..4c6adad 100644 --- a/frontend/src/scripts/event-map.js +++ b/frontend/src/scripts/event-map.js @@ -1,3 +1,4 @@ + const t = window.BOOMCAST_I18N || {}; const mapElement = document.getElementById("event-map"); const h3Resolution = mapElement.dataset.h3Resolution; @@ -7,7 +8,7 @@ compassControl.onAdd = () => { const compass = L.DomUtil.create("div", "map-compass"); compass.setAttribute("role", "img"); - compass.setAttribute("aria-label", "Map compass: north is up"); + compass.setAttribute("aria-label", (t.mapCompass || "Map compass: north is up")); compass.innerHTML = "NESW↑"; L.DomEvent.disableClickPropagation(compass); return compass; @@ -28,8 +29,8 @@ }).addTo(map); polygon.bindPopup( "H3 " + cell.cell + "" + - "" + cell.reports + " reports · " + cell.occurrences + - " occurrences · resolution " + h3Resolution + "" + "" + cell.reports + " " + (cell.reports === 1 ? (t.report || "report") : (t.reports || "reports")) + " · " + cell.occurrences + + " " + (cell.occurrences === 1 ? (t.occurrence || "occurrence") : (t.occurrences || "occurrences")) + " · " + (t.resolution || "resolution") + " " + h3Resolution + "" ); bounds.extend(L.latLngBounds(cell.boundary)); }); @@ -60,17 +61,17 @@ className: "", html: "
✦
", iconSize: [37, 37], iconAnchor: [19, 19], }); reports.forEach((report) => { - const visualStatus = report.visually_confirmed ? "Visually confirmed" : "Not visually confirmed"; - let detail = report.occurrences + " occurrence" + (report.occurrences === 1 ? "" : "s") + - " · " + visualStatus + "
Reported " + report.reported_on; + const visualStatus = report.visually_confirmed ? (t.visuallyConfirmed || "Visually confirmed") : (t.notVisuallyConfirmed || "Not visually confirmed"); + let detail = report.occurrences + " " + (report.occurrences === 1 ? (t.occurrence || "occurrence") : (t.occurrences || "occurrences")) + + " · " + visualStatus + "
" + (t.reported || "Reported") + " " + report.reported_on; if (report.direction_degrees !== null) { - detail += "
Compass direction " + Math.round(report.direction_degrees) + "° (" + cardinalDirection(report.direction_degrees) + ")"; + detail += "
" + (t.compassDirection || "Compass direction") + " " + Math.round(report.direction_degrees) + "° (" + cardinalDirection(report.direction_degrees) + ")"; if (report.direction_accuracy_degrees !== null) { detail += " (±" + Math.round(report.direction_accuracy_degrees) + "°)"; } } L.marker(report.center, { icon: reportIcon }).addTo(map).bindPopup( - "Manual report · H3 " + report.cell + "" + + "" + (t.manualReport || "Manual report") + " · H3 " + report.cell + "" + "" + detail + "" ); diff --git a/frontend/src/scripts/manual-report.js b/frontend/src/scripts/manual-report.js index e2964be..45abdaa 100644 --- a/frontend/src/scripts/manual-report.js +++ b/frontend/src/scripts/manual-report.js @@ -1,3 +1,4 @@ + const t = window.BOOMCAST_I18N || {}; const manualForm = document.querySelector("#manual-report-form"); const manualSubmit = document.querySelector("#manual-submit"); @@ -27,14 +28,14 @@ }; const showCapturedDirection = (heading, accuracy) => { - const accuracyText = accuracy === null ? "Accuracy unavailable" : "Accuracy: ±" + displayDegrees(accuracy) + "°"; + const accuracyText = accuracy === null ? (t.accuracyUnavailable || "Accuracy unavailable") : (t.accuracy || "Accuracy") + ": ±" + displayDegrees(accuracy) + "°"; directionStatus.innerHTML = "" + displayDegrees(heading) + "° · " + cardinalDirection(heading) + "
" + accuracyText; - captureDirectionButton.textContent = "Stop direction capture"; + captureDirectionButton.textContent = (t.stopCapture || "Stop direction capture"); }; const listenForCompassReading = () => { stopCompassReading(); - directionStatus.textContent = "Point the top of your phone toward the sound — direction will update live."; + directionStatus.textContent = (t.pointPhone || "Point the top of your phone toward the sound — direction will update live."); orientationListener = (event) => { const isWebKitCompass = "webkitCompassHeading" in event; const heading = isUsableNumber(event.webkitCompassHeading) @@ -55,34 +56,34 @@ window.addEventListener("deviceorientation", orientationListener); compassUnavailableTimeout = window.setTimeout(() => { stopCompassReading(); - captureDirectionButton.textContent = "Capture direction"; - directionStatus.textContent = "Compass unavailable on this device."; + captureDirectionButton.textContent = (t.captureDirection || "Capture direction"); + directionStatus.textContent = (t.compassUnavailable || "Compass unavailable on this device."); }, 15000); }; const captureDirection = async () => { if (orientationListener) { stopCompassReading(); - captureDirectionButton.textContent = "Capture again"; + captureDirectionButton.textContent = (t.captureAgain || "Capture again"); return; } if (!window.isSecureContext) { - directionStatus.textContent = "Compass capture requires a secure HTTPS connection."; + directionStatus.textContent = (t.secureCompass || "Compass capture requires a secure HTTPS connection."); return; } if (typeof window.DeviceOrientationEvent === "undefined") { - directionStatus.textContent = "Compass unavailable on this device."; + directionStatus.textContent = (t.compassUnavailable || "Compass unavailable on this device."); return; } if (typeof DeviceOrientationEvent.requestPermission === "function") { - directionStatus.textContent = "Requesting compass permission…"; + directionStatus.textContent = (t.compassPermission || "Requesting compass permission…"); try { if (await DeviceOrientationEvent.requestPermission(true) !== "granted") { - directionStatus.textContent = "Compass permission denied."; + directionStatus.textContent = (t.compassDenied || "Compass permission denied."); return; } } catch (error) { - directionStatus.textContent = "Compass permission denied."; + directionStatus.textContent = (t.compassDenied || "Compass permission denied."); return; } } @@ -109,7 +110,7 @@ submitManualReport(); return; } - manualStatus.textContent = "Requesting your optional location…"; + manualStatus.textContent = (t.requestingLocation || "Requesting your optional location…"); navigator.geolocation.getCurrentPosition( (position) => { latitude.value = position.coords.latitude; diff --git a/frontend/src/scripts/theme.js b/frontend/src/scripts/theme.js index b7f2460..fee68fa 100644 --- a/frontend/src/scripts/theme.js +++ b/frontend/src/scripts/theme.js @@ -14,8 +14,9 @@ function applyTheme(theme, button) { document.documentElement.dataset.theme = theme; if (!button) return; const nextTheme = theme === "dark" ? "light" : "dark"; - button.textContent = nextTheme === "light" ? "☀ Light mode" : "☾ Dark mode"; - button.setAttribute("aria-label", "Switch to " + nextTheme + " mode"); + const t = window.BOOMCAST_I18N || {}; + button.textContent = nextTheme === "light" ? "☀ " + (t.lightMode || "Light mode") : "☾ " + (t.darkMode || "Dark mode"); + button.setAttribute("aria-label", nextTheme === "light" ? (t.switchToLight || "Switch to light mode") : (t.switchToDark || "Switch to dark mode")); button.setAttribute("aria-pressed", String(theme === "light")); } diff --git a/hello/templates/home.html b/hello/templates/home.html index f77ddf8..c9ca859 100644 --- a/hello/templates/home.html +++ b/hello/templates/home.html @@ -1,27 +1,27 @@ -{% load vite %} +{% load i18n vite %} - + - Welkom · Sound Signal + {% trans "Welcome · Sound Signal" %} {% vite_asset "frontend/src/entries/home.js" %} - +{% include "js_translations.html" %} - {% if user.is_authenticated %}{{ user.get_username|first|upper }}{% endif %} + {% if user.is_authenticated %}{{ user.get_username|first|upper }}{% endif %}
✦ Sound Signal
-

Control room

-

Welkom {{ naam }}

-

✦ Je leert {{ vak }}. Explore the prototype for live audio classification and future sensor mapping.

+

{% trans "Control room" %}

+

{% blocktrans %}Welcome {{ naam }}{% endblocktrans %}

+

✦ {% blocktrans %}You are learning {{ vak }}. Explore the prototype for live audio classification and future sensor mapping.{% endblocktrans %}

{% include "fireworks_detect/includes/manual_report_form.html" %} diff --git a/locale/nl/LC_MESSAGES/django.mo b/locale/nl/LC_MESSAGES/django.mo new file mode 100644 index 0000000..aaa132f Binary files /dev/null and b/locale/nl/LC_MESSAGES/django.mo differ diff --git a/locale/nl/LC_MESSAGES/django.po b/locale/nl/LC_MESSAGES/django.po new file mode 100644 index 0000000..c890e50 --- /dev/null +++ b/locale/nl/LC_MESSAGES/django.po @@ -0,0 +1,1196 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: BoomCast\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-10-01 20:39+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: fireworks_detect/admin.py:26 +#: fireworks_detect/templates/fireworks_detect/event_detail.html:9 +#: fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html:15 +msgid "Direction" +msgstr "Richting" + +#: fireworks_detect/admin.py:30 +msgid "Classifier response" +msgstr "Classificatierespons" + +#: fireworks_detect/admin.py:42 +msgid "Approve selected samples and move them to Events" +msgstr "Geselecteerde opnamen goedkeuren en naar Gebeurtenissen verplaatsen" + +#: fireworks_detect/admin.py:48 +#, python-format +msgid "%(count)d sample approved and moved to Events." +msgid_plural "%(count)d samples approved and moved to Events." +msgstr[0] "%(count)d opname goedgekeurd en naar Gebeurtenissen verplaatst." +msgstr[1] "%(count)d opnamen goedgekeurd en naar Gebeurtenissen verplaatst." + +#: fireworks_detect/admin.py:50 +msgid "Deny selected samples and delete their uploaded audio" +msgstr "Geselecteerde opnamen afwijzen en hun audiobestanden verwijderen" + +#: fireworks_detect/admin.py:56 +#, python-format +msgid "%(count)d sample denied and removed." +msgid_plural "%(count)d samples denied and removed." +msgstr[0] "%(count)d opname afgewezen en verwijderd." +msgstr[1] "%(count)d opnamen afgewezen en verwijderd." + +#: fireworks_detect/admin.py:76 fireworks_detect/models.py:75 +msgid "Sensor" +msgstr "Sensor" + +#: fireworks_detect/admin.py:77 +msgid "API token" +msgstr "API-token" + +#: fireworks_detect/admin.py:77 +msgid "" +"Save the sensor first, select it in the list, then choose ‘Issue or rotate " +"API token’. The complete token is shown once only; its salted hash is the " +"only value stored." +msgstr "Sla de sensor eerst op, selecteer hem in de lijst en kies daarna ‘API-token uitgeven of vervangen’. Het volledige token wordt maar één keer getoond; alleen de beveiligde hash wordt opgeslagen." + +#: fireworks_detect/admin.py:78 fireworks_detect/admin.py:81 +msgid "Heartbeat" +msgstr "Statussignaal" + +#: fireworks_detect/admin.py:78 +msgid "" +"Devices should POST to /fireworks/heartbeat/ with Authorization: Bearer " +". Green means seen within 5 minutes; amber within 15; red is older or " +"never seen." +msgstr "Apparaten sturen een POST naar /fireworks/heartbeat/ met Authorization: Bearer . Groen betekent gezien in de afgelopen 5 minuten, oranje in de afgelopen 15 minuten en rood betekent ouder of nooit gezien." + +#: fireworks_detect/admin.py:84 +msgid "Never seen" +msgstr "Nog nooit gezien" + +#: fireworks_detect/admin.py:88 +msgid "Online" +msgstr "Online" + +#: fireworks_detect/admin.py:90 +msgid "Delayed" +msgstr "Vertraagd" + +#: fireworks_detect/admin.py:92 +msgid "Offline" +msgstr "Offline" + +#: fireworks_detect/admin.py:95 +msgid "Issue or rotate API token (shown once)" +msgstr "API-token uitgeven of vervangen (eenmalig zichtbaar)" + +#: fireworks_detect/admin.py:98 +msgid "Select exactly one sensor to issue a token." +msgstr "Selecteer precies één sensor om een token uit te geven." + +#: fireworks_detect/admin.py:102 +#, python-brace-format +msgid "" +"Copy this token now; it is not stored and will not be shown again: {}" +msgstr "Kopieer dit token nu; het wordt niet opgeslagen en niet opnieuw getoond: {}" + +#: fireworks_detect/models.py:15 +msgid "A recognisable device name, e.g. Garden ESP32." +msgstr "Een herkenbare apparaatnaam, bijvoorbeeld Tuin ESP32." + +#: fireworks_detect/models.py:54 +msgid "Whitelist" +msgstr "Toestaan" + +#: fireworks_detect/models.py:55 +msgid "Blacklist" +msgstr "Blokkeren" + +#: fireworks_detect/models.py:76 +#: fireworks_detect/templates/fireworks_detect/events_list.html:7 +#: templates/js_translations.html:42 +msgid "Manual report" +msgstr "Handmatige melding" + +#: fireworks_detect/models.py:107 +msgid "" +"Direction must be a finite value from 0 up to, but not including, 360 " +"degrees." +msgstr "De richting moet een eindige waarde van 0 tot, maar niet inclusief, 360 graden zijn." + +#: fireworks_detect/models.py:111 +msgid "Compass accuracy must be a finite, non-negative value." +msgstr "De kompasnauwkeurigheid moet een eindige waarde van nul of hoger zijn." + +#: fireworks_detect/models.py:142 +msgid "No prediction" +msgstr "Geen voorspelling" + +#: fireworks_detect/models.py:181 +msgid "Pending event" +msgstr "Gebeurtenis in afwachting" + +#: fireworks_detect/models.py:182 +msgid "Pending" +msgstr "In afwachting" + +#: fireworks_detect/models.py:218 +msgid "Event" +msgstr "Gebeurtenis" + +#: fireworks_detect/models.py:219 +#: fireworks_detect/templates/fireworks_detect/includes/navigation.html:8 +msgid "Events" +msgstr "Gebeurtenissen" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:4 +msgid "Analysis unavailable" +msgstr "Analyse niet beschikbaar" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:11 +msgid "Analysis complete" +msgstr "Analyse voltooid" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:14 +msgid "Ready" +msgstr "Gereed" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:18 +#, python-format +msgid "%(duration)s seconds" +msgstr "%(duration)s seconden" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:19 +#, python-format +msgid "%(frames)s frames analysed" +msgstr "%(frames)s frames geanalyseerd" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:20 +#, python-format +msgid "%(rate)s Hz model rate" +msgstr "Modelsnelheid: %(rate)s Hz" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:23 +msgid "Result legend" +msgstr "Legenda van de resultaten" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:24 +#, python-format +msgid "%(count)s firework-related signal" +msgid_plural "%(count)s firework-related signals" +msgstr[0] "%(count)s vuurwerkgerelateerd signaal" +msgstr[1] "%(count)s vuurwerkgerelateerde signalen" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:25 +#, python-format +msgid "%(count)s speech/privacy signal" +msgid_plural "%(count)s speech/privacy signals" +msgstr[0] "%(count)s spraak- of privacysignaal" +msgstr[1] "%(count)s spraak- of privacysignalen" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:30 +#: fireworks_detect/templates/fireworks_detect/event_detail.html:16 +#: templates/admin/fireworks_detect/classification_change_form.html:2 +msgid "Top sound classes" +msgstr "Meest waarschijnlijke geluiden" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:41 +msgid "No overall predictions were returned." +msgstr "Er zijn geen algemene voorspellingen ontvangen." + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:45 +#: fireworks_detect/templates/fireworks_detect/event_detail.html:22 +#: templates/admin/fireworks_detect/classification_change_form.html:2 +msgid "Notable moments" +msgstr "Opvallende momenten" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:59 +msgid "No peak events were returned." +msgstr "Er zijn geen piekmomenten gevonden." + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:65 +msgid "Submit this sample for review" +msgstr "Deze opname ter beoordeling indienen" + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:65 +msgid "The audio and signed classifier response will be added to Pending." +msgstr "De audio en de ondertekende classificatierespons worden toegevoegd aan In afwachting." + +#: fireworks_detect/templates/fireworks_detect/classification_result.html:66 +msgid "Send to Pending →" +msgstr "Naar In afwachting sturen →" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:7 +msgid "Report fireworks · Sound Signal" +msgstr "Vuurwerk melden · Sound Signal" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:14 +#: hello/templates/home.html:12 +#, fuzzy, python-format +#| msgid "Settings for %(user)s" +msgid "Open settings for %(username)s" +msgstr "Instellingen openen voor %(username)s" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:14 +#: hello/templates/home.html:12 members/templates/members/user_settings.html:13 +msgid "Settings" +msgstr "Instellingen" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:19 +msgid "Community reporting" +msgstr "Meldingen uit de buurt" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:20 +msgid "Report what you heard." +msgstr "Meld wat je hebt gehoord." + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:21 +msgid "" +"Quickly log fireworks when they happen. Your optional location is " +"represented as an H3 cell on the map, rather than as precise coordinates." +msgstr "Meld vuurwerk zodra je het hoort. Je optionele locatie verschijnt op de kaart als H3-cel in plaats van als exacte coördinaten." + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:24 +msgid "Quick fireworks report" +msgstr "Snel vuurwerk melden" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:32 +msgid "Recent reports" +msgstr "Recente meldingen" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:32 +msgid "Activity map" +msgstr "Activiteitenkaart" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:33 +msgid "Open map controls" +msgstr "Kaartinstellingen openen" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:40 +msgid "Audio analysis" +msgstr "Audioanalyse" + +#: fireworks_detect/templates/fireworks_detect/dashboard.html:40 +msgid "Classify a recording" +msgstr "Opname analyseren" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:3 +#: fireworks_detect/templates/fireworks_detect/events_list.html:8 +msgid "Manual fireworks report" +msgstr "Handmatige vuurwerkmelding" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:4 +#, python-format +msgid "Approved %(date)s · Reported manually" +msgstr "Goedgekeurd op %(date)s · Handmatig gemeld" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:5 +msgid "Report details" +msgstr "Details van de melding" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:6 +msgid "Occurrences" +msgstr "Aantal keren" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:7 +msgid "Location" +msgstr "Locatie" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:8 +msgid "Captured location" +msgstr "Vastgelegde locatie" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:10 +msgid "Compass accuracy" +msgstr "Kompasnauwkeurigheid" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:11 +#: fireworks_detect/templates/fireworks_detect/map.html:26 +#: templates/js_translations.html:22 +msgid "Visually confirmed" +msgstr "Visueel bevestigd" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:11 +msgid "Yes" +msgstr "Ja" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:11 +msgid "No" +msgstr "Nee" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:12 +msgid "This was a manual report; there is no audio classification attached." +msgstr "Dit is een handmatige melding zonder audioclassificatie." + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:15 +#, python-format +msgid "Approved %(date)s · %(duration)s seconds · %(frames)s frames" +msgstr "Goedgekeurd op %(date)s · %(duration)s seconden · %(frames)s frames" + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:20 +#: templates/admin/fireworks_detect/classification_change_form.html:2 +msgid "No predictions returned." +msgstr "Er zijn geen voorspellingen ontvangen." + +#: fireworks_detect/templates/fireworks_detect/event_detail.html:26 +#: templates/admin/fireworks_detect/classification_change_form.html:2 +msgid "No peak events returned." +msgstr "Er zijn geen piekmomenten gevonden." + +#: fireworks_detect/templates/fireworks_detect/events.html:2 +msgid "Events · Sound Signal" +msgstr "Gebeurtenissen · Sound Signal" + +#: fireworks_detect/templates/fireworks_detect/events.html:2 +msgid "Reviewed signal archive" +msgstr "Archief van beoordeelde signalen" + +#: fireworks_detect/templates/fireworks_detect/events.html:2 +msgid "Approved events." +msgstr "Goedgekeurde gebeurtenissen." + +#: fireworks_detect/templates/fireworks_detect/events.html:2 +msgid "" +"This feed refreshes automatically every three seconds after a pending sample " +"is approved in admin." +msgstr "Deze lijst wordt elke drie seconden bijgewerkt nadat een opname in het beheer is goedgekeurd." + +#: fireworks_detect/templates/fireworks_detect/events.html:2 +msgid "Latest events" +msgstr "Nieuwste gebeurtenissen" + +#: fireworks_detect/templates/fireworks_detect/events.html:2 +msgid "Loading events…" +msgstr "Gebeurtenissen laden…" + +#: fireworks_detect/templates/fireworks_detect/events.html:2 +msgid "Select an event" +msgstr "Selecteer een gebeurtenis" + +#: fireworks_detect/templates/fireworks_detect/events.html:2 +msgid "Choose an approved event to inspect its classification details." +msgstr "Kies een goedgekeurde gebeurtenis om de classificatiegegevens te bekijken." + +#: fireworks_detect/templates/fireworks_detect/events_list.html:9 +#, python-format +msgid "%(count)s occurrence" +msgid_plural "%(count)s occurrences" +msgstr[0] "%(count)s keer" +msgstr[1] "%(count)s keer" + +#: fireworks_detect/templates/fireworks_detect/events_list.html:11 +msgid "Sensor classification" +msgstr "Sensorclassificatie" + +#: fireworks_detect/templates/fireworks_detect/events_list.html:16 +msgid "Manual" +msgstr "Handmatig" + +#: fireworks_detect/templates/fireworks_detect/events_list.html:20 +msgid "" +"No approved events yet. Submit a classification, then approve it from the " +"Pending page in admin." +msgstr "Er zijn nog geen goedgekeurde gebeurtenissen. Dien een classificatie in en keur die goed via In afwachting in het beheer." + +#: fireworks_detect/templates/fireworks_detect/home.html:8 +#: fireworks_detect/templates/home.html:7 +msgid "Sound Signal · Fireworks detection" +msgstr "Sound Signal · Vuurwerkdetectie" + +#: fireworks_detect/templates/fireworks_detect/home.html:20 +#: fireworks_detect/templates/home.html:15 +msgid "Audio event analysis" +msgstr "Analyse van geluidsgebeurtenissen" + +#: fireworks_detect/templates/fireworks_detect/home.html:21 +#: fireworks_detect/templates/home.html:16 +msgid "See what your audio heard." +msgstr "Ontdek wat je opname heeft vastgelegd." + +#: fireworks_detect/templates/fireworks_detect/home.html:22 +#: fireworks_detect/templates/home.html:17 +msgid "" +"Drop a recording to identify its most likely sounds. Firework-related " +"signals are highlighted in amber; speech-related signals are marked in red " +"for future privacy filtering." +msgstr "Sleep een opname hierheen om de meest waarschijnlijke geluiden te herkennen. Vuurwerkgerelateerde signalen zijn oranje gemarkeerd; spraak is rood gemarkeerd voor toekomstige privacyfiltering." + +#: fireworks_detect/templates/fireworks_detect/home.html:23 +msgid "Here are some samples to test with" +msgstr "Hier vind je voorbeeldgeluiden om te testen" + +#: fireworks_detect/templates/fireworks_detect/home.html:27 +#: fireworks_detect/templates/home.html:20 +msgid "Upload audio for classification" +msgstr "Audio uploaden voor classificatie" + +#: fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html:8 +#: fireworks_detect/templates/home.html:27 +msgid "Drop an audio file here" +msgstr "Sleep hier een audiobestand naartoe" + +#: fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html:9 +#: fireworks_detect/templates/home.html:28 +msgid "or click to browse your device" +msgstr "of klik om een bestand te kiezen" + +#: fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html:11 +#: fireworks_detect/templates/home.html:30 templates/js_translations.html:4 +msgid "No file selected" +msgstr "Geen bestand geselecteerd" + +#: fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html:14 +#: fireworks_detect/templates/home.html:33 +msgid "WAV, MP3, M4A, OGG and more · 25 MiB maximum" +msgstr "WAV, MP3, M4A, OGG en meer · maximaal 25 MiB" + +#: fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html:15 +#: fireworks_detect/templates/home.html:34 +msgid "Analyse audio" +msgstr "Audio analyseren" + +#: fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html:17 +#: fireworks_detect/templates/home.html:40 +msgid "Classification results" +msgstr "Classificatieresultaten" + +#: fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html:3 +msgid "No recording needed" +msgstr "Geen opname nodig" + +#: fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html:4 +msgid "Report fireworks now" +msgstr "Nu vuurwerk melden" + +#: fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html:5 +msgid "" +"Choose how many times you heard fireworks, then send it straight to Pending. " +"The report is timestamped now." +msgstr "Geef aan hoe vaak je vuurwerk hoorde en dien de melding direct ter beoordeling in. Het tijdstip wordt nu vastgelegd." + +#: fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html:8 +msgid "Number of occurrences" +msgstr "Aantal keren gehoord" + +#: fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html:15 +#| msgid "Location" +msgid "optional" +msgstr "optioneel" + +#: fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html:16 +msgid "" +"Point the top of your phone toward the fireworks, then capture a single " +"compass reading." +msgstr "Richt de bovenkant van je telefoon naar het vuurwerk en leg een kompasrichting vast." + +#: fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html:17 +#: templates/js_translations.html:11 +msgid "Capture direction" +msgstr "Richting vastleggen" + +#: fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html:20 +msgid "I heard fireworks — send to Pending" +msgstr "Ik hoorde vuurwerk — melding indienen" + +#: fireworks_detect/templates/fireworks_detect/includes/map_panel.html:2 +msgid "Manual fireworks report map" +msgstr "Kaart met handmatige vuurwerkmeldingen" + +#: fireworks_detect/templates/fireworks_detect/includes/map_panel.html:3 +msgid "Manual reports · privacy-preserving H3 cells" +msgstr "Handmatige meldingen · privacyvriendelijke H3-cellen" + +#: fireworks_detect/templates/fireworks_detect/includes/map_panel.html:3 +#, python-format +msgid "H3 resolution %(resolution)s · sensor layer disabled" +msgstr "H3-resolutie %(resolution)s · sensorlaag uitgeschakeld" + +#: fireworks_detect/templates/fireworks_detect/includes/map_panel.html:4 +msgid "Interactive map of manual fireworks reports" +msgstr "Interactieve kaart met handmatige vuurwerkmeldingen" + +#: fireworks_detect/templates/fireworks_detect/includes/map_panel.html:5 +msgid "Map legend" +msgstr "Kaartlegenda" + +#: fireworks_detect/templates/fireworks_detect/includes/map_panel.html:5 +#: fireworks_detect/templates/fireworks_detect/map.html:22 +msgid "Manual reports" +msgstr "Handmatige meldingen" + +#: fireworks_detect/templates/fireworks_detect/includes/map_panel.html:5 +msgid "Report marker at H3-cell centre" +msgstr "Meldingsmarkering in het midden van de H3-cel" + +#: fireworks_detect/templates/fireworks_detect/includes/map_panel.html:5 +#, python-format +msgid "H3 cell (resolution %(resolution)s)" +msgstr "H3-cel (resolutie %(resolution)s)" + +#: fireworks_detect/templates/fireworks_detect/includes/map_panel.html:5 +msgid "Saved compass direction" +msgstr "Opgeslagen kompasrichting" + +#: fireworks_detect/templates/fireworks_detect/includes/navigation.html:5 +msgid "Fireworks navigation" +msgstr "Vuurwerknavigatie" + +#: fireworks_detect/templates/fireworks_detect/includes/navigation.html:6 +msgid "Analyse" +msgstr "Analyse" + +#: fireworks_detect/templates/fireworks_detect/includes/navigation.html:7 +msgid "Map" +msgstr "Kaart" + +#: fireworks_detect/templates/fireworks_detect/includes/navigation.html:14 +#: members/templates/members/user_settings.html:19 +msgid "Language" +msgstr "Taal" + +#: fireworks_detect/templates/fireworks_detect/includes/navigation.html:22 +#| msgid "Switch to light mode" +msgid "Switch theme" +msgstr "Thema wisselen" + +#: fireworks_detect/templates/fireworks_detect/manual_pending_submission.html:4 +msgid "Could not report fireworks" +msgstr "Vuurwerk melden mislukt" + +#: fireworks_detect/templates/fireworks_detect/manual_pending_submission.html:6 +msgid "Report sent to Pending" +msgstr "Melding ingediend ter beoordeling" + +#: fireworks_detect/templates/fireworks_detect/manual_pending_submission.html:6 +#, python-format +msgid "%(count)s occurrence reported at %(time)s." +msgid_plural "%(count)s occurrences reported at %(time)s." +msgstr[0] "%(count)s keer gemeld om %(time)s." +msgstr[1] "%(count)s keer gemeld om %(time)s." + +#: fireworks_detect/templates/fireworks_detect/map.html:7 +msgid "Signal map · Sound Signal" +msgstr "Signaalkaart · Sound Signal" + +#: fireworks_detect/templates/fireworks_detect/map.html:17 +msgid "Manual report intelligence" +msgstr "Inzicht in handmatige meldingen" + +#: fireworks_detect/templates/fireworks_detect/map.html:17 +msgid "Sound activity map." +msgstr "Kaart met geluidsactiviteit." + +#: fireworks_detect/templates/fireworks_detect/map.html:18 +msgid "" +"Reviewed manual reports with a captured location appear as their H3 cell, " +"not their precise coordinates. Saved phone compass readings show the " +"reported direction of the sound." +msgstr "Beoordeelde handmatige meldingen met een locatie verschijnen als H3-cel, zonder exacte coördinaten. Opgeslagen kompasmetingen tonen de gemelde richting van het geluid." + +#: fireworks_detect/templates/fireworks_detect/map.html:21 +msgid "Map filters" +msgstr "Kaartfilters" + +#: fireworks_detect/templates/fireworks_detect/map.html:22 +msgid "Source" +msgstr "Bron" + +#: fireworks_detect/templates/fireworks_detect/map.html:22 +msgid "Sensor events — coming soon" +msgstr "Sensorgebeurtenissen — binnenkort" + +#: fireworks_detect/templates/fireworks_detect/map.html:23 +msgid "Period" +msgstr "Periode" + +#: fireworks_detect/templates/fireworks_detect/map.html:23 +msgid "Last 7 days" +msgstr "Afgelopen 7 dagen" + +#: fireworks_detect/templates/fireworks_detect/map.html:23 +msgid "Last 2 weeks" +msgstr "Afgelopen 2 weken" + +#: fireworks_detect/templates/fireworks_detect/map.html:23 +msgid "Last 30 days" +msgstr "Afgelopen 30 dagen" + +#: fireworks_detect/templates/fireworks_detect/map.html:23 +msgid "All time" +msgstr "Hele periode" + +#: fireworks_detect/templates/fireworks_detect/map.html:23 +msgid "Custom range" +msgstr "Aangepaste periode" + +#: fireworks_detect/templates/fireworks_detect/map.html:24 +msgid "From" +msgstr "Van" + +#: fireworks_detect/templates/fireworks_detect/map.html:25 +msgid "To" +msgstr "Tot" + +#: fireworks_detect/templates/fireworks_detect/map.html:26 +msgid "Visual confirmation" +msgstr "Visuele bevestiging" + +#: fireworks_detect/templates/fireworks_detect/map.html:26 +msgid "Any report" +msgstr "Alle meldingen" + +#: fireworks_detect/templates/fireworks_detect/map.html:26 +#: templates/js_translations.html:23 +msgid "Not visually confirmed" +msgstr "Niet visueel bevestigd" + +#: fireworks_detect/templates/fireworks_detect/map.html:27 +msgid "Apply filters" +msgstr "Filters toepassen" + +#: fireworks_detect/templates/fireworks_detect/map.html:28 +#, python-format +msgid "%(count)s report" +msgid_plural "%(count)s reports" +msgstr[0] "%(count)s melding" +msgstr[1] "%(count)s meldingen" + +#: fireworks_detect/templates/fireworks_detect/pending_submission.html:3 +msgid "Could not submit this sample" +msgstr "Opname indienen mislukt" + +#: fireworks_detect/templates/fireworks_detect/pending_submission.html:3 +msgid "Sent to Pending" +msgstr "Ingediend ter beoordeling" + +#: fireworks_detect/templates/fireworks_detect/pending_submission.html:3 +#, python-format +msgid "%(filename)s is ready for administrator review." +msgstr "%(filename)s staat klaar voor beoordeling door een beheerder." + +#: fireworks_detect/templates/fireworks_detect/pending_submission.html:3 +msgid "View events" +msgstr "Gebeurtenissen bekijken" + +#: fireworks_detect/views.py:243 +msgid "Choose an audio file before starting the analysis." +msgstr "Kies een audiobestand voordat je de analyse start." + +#: fireworks_detect/views.py:247 +msgid "Please upload a supported audio file (such as WAV, MP3, M4A, or OGG)." +msgstr "Upload een ondersteund audiobestand, zoals WAV, MP3, M4A of OGG." + +#: fireworks_detect/views.py:249 +msgid "This demo accepts audio files up to 25 MiB." +msgstr "Deze demo accepteert audiobestanden tot 25 MiB." + +#: fireworks_detect/views.py:263 +#, python-format +msgid "The classifier returned an error (HTTP %(code)s)." +msgstr "De classifier gaf een foutmelding (HTTP %(code)s)." + +#: fireworks_detect/views.py:265 +msgid "The classifier could not be reached. Please try again shortly." +msgstr "De classifier is niet bereikbaar. Probeer het binnenkort opnieuw." + +#: fireworks_detect/views.py:267 +msgid "The classifier returned an unreadable response." +msgstr "De classifier gaf een onleesbaar antwoord." + +#: fireworks_detect/views.py:270 +msgid "The classifier returned an unexpected response." +msgstr "De classifier gaf een onverwacht antwoord." + +#: fireworks_detect/views.py:285 +msgid "Keep the analysed audio file selected before submitting it for review." +msgstr "Laat het geanalyseerde audiobestand geselecteerd voordat je het ter beoordeling indient." + +#: fireworks_detect/views.py:287 +msgid "Analyse the file before submitting it for review." +msgstr "Analyseer het bestand voordat je het ter beoordeling indient." + +#: fireworks_detect/views.py:292 +msgid "This analysis has expired. Please analyse the audio again." +msgstr "Deze analyse is verlopen. Analyseer het audiobestand opnieuw." + +#: fireworks_detect/views.py:295 +msgid "The saved analysis is not valid." +msgstr "De opgeslagen analyse is ongeldig." + +#: fireworks_detect/views.py:345 +msgid "Choose between 1 and 1,000 occurrences." +msgstr "Kies een aantal tussen 1 en 1.000." + +#: fireworks_detect/views.py:383 +msgid "No audio is attached to this record." +msgstr "Aan dit item is geen audio gekoppeld." + +#: hello/templates/home.html:7 +#| msgid "Events · Sound Signal" +msgid "Welcome · Sound Signal" +msgstr "Welkom · Sound Signal" + +#: hello/templates/home.html:16 +msgid "Control room" +msgstr "Controlekamer" + +#: hello/templates/home.html:17 +#, fuzzy, python-format +#| msgid "Hello, %(name)s!" +msgid "Welcome %(naam)s" +msgstr "Welkom %(naam)s" + +#: hello/templates/home.html:18 +#, python-format +msgid "" +"You are learning %(vak)s. Explore the prototype for live audio " +"classification and future sensor mapping." +msgstr "Je leert %(vak)s. Ontdek het prototype voor live audioclassificatie en toekomstige sensorkaarten." + +#: hello/templates/home.html:20 +#| msgid "Fireworks Detector" +msgid "Open fireworks detector" +msgstr "Vuurwerkdetector openen" + +#: hello/templates/home.html:21 +#| msgid "Open map controls" +msgid "Open map concept" +msgstr "Kaartconcept openen" + +#: hello/templates/home.html:22 +msgid "Open form" +msgstr "Formulier openen" + +#: hello/templates/home.html:23 +#| msgid "View events" +msgid "Open events" +msgstr "Gebeurtenissen openen" + +#: hello/templates/home.html:24 +#| msgid "Audio analysis" +msgid "Audio analysis · Sensor map" +msgstr "Audioanalyse · Sensorkaart" + +#: members/models.py:27 members/models.py:28 +msgid "User settings" +msgstr "Gebruikersinstellingen" + +#: members/models.py:31 +#, python-format +msgid "Settings for %(user)s" +msgstr "Instellingen voor %(user)s" + +#: members/templates/hello-form.html:7 members/templates/success-form.html:7 +msgid "Hello" +msgstr "Hallo" + +#: members/templates/hello-form.html:12 members/templates/success-form.html:12 +msgid "A warm welcome" +msgstr "Hartelijk welkom" + +#: members/templates/hello-form.html:13 members/templates/success-form.html:13 +msgid "What’s your name?" +msgstr "Hoe heet je?" + +#: members/templates/hello-form.html:14 +msgid "Enter your name below and we’ll say hello." +msgstr "Vul hieronder je naam in, dan zeggen we hallo." + +#: members/templates/hello-form.html:19 +msgid "Save" +msgstr "Opslaan" + +#: members/templates/hello-form.html:26 members/templates/success-form.html:21 +#| msgid "All members" +msgid "Show members" +msgstr "Leden tonen" + +#: members/templates/members-list.html:7 +#| msgid "Member" +msgid "Members" +msgstr "Leden" + +#: members/templates/members-list.html:17 +msgid "Member directory" +msgstr "Ledenoverzicht" + +#: members/templates/members-list.html:19 +msgid "All members" +msgstr "Alle leden" + +#: members/templates/members-list.html:20 +msgid "A complete overview of everyone currently registered in the database." +msgstr "Een overzicht van iedereen die momenteel in de database staat." + +#: members/templates/members-list.html:23 +#, python-format +msgid "%(count)s member" +msgid_plural "%(count)s members" +msgstr[0] "%(count)s lid" +msgstr[1] "%(count)s leden" + +#: members/templates/members-list.html:33 +msgid "Member" +msgstr "Lid" + +#: members/templates/members-list.html:34 +msgid "Phone number" +msgstr "Telefoonnummer" + +#: members/templates/members-list.html:35 +msgid "Joined" +msgstr "Aangemeld" + +#: members/templates/members-list.html:59 +msgid "No members yet" +msgstr "Nog geen leden" + +#: members/templates/members-list.html:60 +msgid "Add the first member to see them here." +msgstr "Voeg het eerste lid toe om het hier te zien." + +#: members/templates/members-list.html:66 +#: members/templates/success-form.html:20 +msgid "Open another form" +msgstr "Nog een formulier openen" + +#: members/templates/members/login.html:7 +msgid "Sign in · Sound Signal" +msgstr "Inloggen · Sound Signal" + +#: members/templates/members/login.html:13 +#: members/templates/members/login.html:25 templates/admin/login.html:1 +msgid "Sign in" +msgstr "Inloggen" + +#: members/templates/members/login.html:14 +msgid "Sign in to manage your notification settings." +msgstr "Log in om je meldingsinstellingen te beheren." + +#: members/templates/members/login.html:16 templates/admin/login.html:1 +msgid "Your username and password did not match. Please try again." +msgstr "Je gebruikersnaam en wachtwoord komen niet overeen. Probeer het opnieuw." + +#: members/templates/members/login.html:20 templates/admin/login.html:1 +msgid "Username" +msgstr "Gebruikersnaam" + +#: members/templates/members/login.html:22 templates/admin/login.html:1 +msgid "Password" +msgstr "Wachtwoord" + +#: members/templates/members/login.html:27 +msgid "You will return to the page you requested." +msgstr "Na het inloggen ga je terug naar de gevraagde pagina." + +#: members/templates/members/ntfy_test_result.html:2 +msgid "Test notification sent successfully." +msgstr "Testmelding verzonden." + +#: members/templates/members/ntfy_test_result.html:2 +msgid "Could not send the test notification:" +msgstr "Testmelding kon niet worden verzonden:" + +#: members/templates/members/user_settings.html:7 +msgid "Settings · Sound Signal" +msgstr "Instellingen · Sound Signal" + +#: members/templates/members/user_settings.html:14 +msgid "Manage your personal preferences." +msgstr "Beheer je persoonlijke voorkeuren." + +#: members/templates/members/user_settings.html:20 +msgid "Preferred language" +msgstr "Voorkeurstaal" + +#: members/templates/members/user_settings.html:24 +msgid "Save language" +msgstr "Taal opslaan" + +#: members/templates/members/user_settings.html:29 +msgid "Notifications / ntfy" +msgstr "Meldingen / ntfy" + +#: members/templates/members/user_settings.html:30 +msgid "" +"Use a topic URL from your ntfy server. Test the current URL before saving it." +msgstr "Gebruik een onderwerp-URL van je ntfy-server. Test de URL voordat je hem opslaat." + +#: members/templates/members/user_settings.html:31 +msgid "Topic URL" +msgstr "Onderwerp-URL" + +#: members/templates/members/user_settings.html:34 +msgid "Enable ntfy notifications" +msgstr "ntfy-meldingen inschakelen" + +#: members/templates/members/user_settings.html:35 +msgid "Test notification" +msgstr "Melding testen" + +#: members/templates/members/user_settings.html:38 +msgid "Save settings" +msgstr "Instellingen opslaan" + +#: members/templates/success-form.html:14 +msgid "Added to the database." +msgstr "Toegevoegd aan de database." + +#: members/views.py:42 +#, python-format +msgid "Hello, %(name)s!" +msgstr "Hallo, %(name)s!" + +#: members/views.py:44 +msgid "Please enter your name." +msgstr "Vul je naam in." + +#: members/views.py:54 +msgid "Enter an ntfy topic URL." +msgstr "Vul een ntfy-onderwerp-URL in." + +#: members/views.py:75 +msgid "Language preference saved." +msgstr "Taalvoorkeur opgeslagen." + +#: members/views.py:87 +msgid "Test this URL successfully before saving notification settings." +msgstr "Test deze URL voordat je de meldingsinstellingen opslaat." + +#: members/views.py:97 +msgid "Notification settings saved." +msgstr "Meldingsinstellingen opgeslagen." + +#: members/views.py:113 +msgid "Enter a valid HTTP or HTTPS ntfy topic URL." +msgstr "Vul een geldige HTTP- of HTTPS-URL voor een ntfy-onderwerp in." + +#: members/views.py:120 +msgid "Fireworks Detector" +msgstr "Vuurwerkdetector" + +#: members/views.py:121 +msgid "ntfy notifications are configured correctly." +msgstr "ntfy-meldingen zijn goed ingesteld." + +#: templates/404.html:7 +msgid "Page not found · Sound Signal" +msgstr "Pagina niet gevonden · Sound Signal" + +#: templates/404.html:13 +msgid "Signal lost" +msgstr "Signaal kwijt" + +#: templates/404.html:14 +msgid "This page wandered off." +msgstr "Deze pagina is verdwenen." + +#: templates/404.html:15 +msgid "" +"The address does not point to anything in this corner of Sound Signal. Try " +"one of the routes below instead." +msgstr "Dit adres verwijst niet naar een pagina van Sound Signal. Probeer een van de links hieronder." + +#: templates/404.html:18 +msgid "Go home" +msgstr "Naar de startpagina" + +#: templates/404.html:19 +msgid "Open Sound Signal" +msgstr "Sound Signal openen" + +#: templates/admin/base_site.html:1 +msgid "Administration" +msgstr "Beheer" + +#: templates/admin/fireworks_detect/classification_audio_change_form.html:15 +msgid "Play recording" +msgstr "Opname afspelen" + +#: templates/admin/fireworks_detect/classification_audio_change_form.html:17 +msgid "Loads only when played" +msgstr "Wordt pas geladen bij afspelen" + +#: templates/admin/fireworks_detect/classification_change_form.html:2 +msgid "Classification preview" +msgstr "Voorbeeld van de classificatie" + +#: templates/admin/fireworks_detect/classification_change_form.html:2 +msgid "Show raw classifier JSON" +msgstr "Ruwe classifier-JSON tonen" + +#: templates/admin/login.html:1 +msgid "Log in" +msgstr "Inloggen" + +#: templates/admin/login.html:1 +msgid "Secure access" +msgstr "Beveiligde toegang" + +#: templates/admin/login.html:1 +msgid "Welcome back." +msgstr "Welkom terug." + +#: templates/admin/login.html:1 +msgid "Sign in to review pending audio samples and manage approved events." +msgstr "Log in om opnamen in afwachting te beoordelen en goedgekeurde gebeurtenissen te beheren." + +#: templates/admin/login.html:1 +#, python-format +msgid "" +"You are authenticated as %(username)s, but are not authorized to access this " +"page. Would you like to log in to a different account?" +msgstr "Je bent ingelogd als %(username)s, maar hebt geen toegang tot deze pagina. Wil je inloggen met een ander account?" + +#: templates/admin/login.html:1 +msgid "Sound Signal administration" +msgstr "Sound Signal-beheer" + +#: templates/js_translations.html:5 +msgid "Analysing your recording…" +msgstr "Je opname wordt geanalyseerd…" + +#: templates/js_translations.html:6 +msgid "Analysis could not be completed." +msgstr "De analyse kon niet worden voltooid." + +#: templates/js_translations.html:7 +msgid "Accuracy unavailable" +msgstr "Nauwkeurigheid niet beschikbaar" + +#: templates/js_translations.html:8 +msgid "Accuracy" +msgstr "Nauwkeurigheid" + +#: templates/js_translations.html:9 +msgid "Stop direction capture" +msgstr "Vastleggen van richting stoppen" + +#: templates/js_translations.html:10 +msgid "" +"Point the top of your phone toward the sound — direction will update live." +msgstr "Richt de bovenkant van je telefoon naar het geluid. De richting wordt live bijgewerkt." + +#: templates/js_translations.html:12 +msgid "Capture again" +msgstr "Opnieuw vastleggen" + +#: templates/js_translations.html:13 +msgid "Compass unavailable on this device." +msgstr "Kompas niet beschikbaar op dit apparaat." + +#: templates/js_translations.html:14 +msgid "Compass capture requires a secure HTTPS connection." +msgstr "Voor het kompas is een beveiligde HTTPS-verbinding nodig." + +#: templates/js_translations.html:15 +msgid "Requesting compass permission…" +msgstr "Toestemming voor het kompas aanvragen…" + +#: templates/js_translations.html:16 +msgid "Compass permission denied." +msgstr "Toegang tot het kompas geweigerd." + +#: templates/js_translations.html:17 +msgid "Requesting your optional location…" +msgstr "Je optionele locatie wordt opgevraagd…" + +#: templates/js_translations.html:18 +msgid "Map compass: north is up" +msgstr "Kaartkompas: noord is boven" + +#: templates/js_translations.html:19 +msgid "reports" +msgstr "meldingen" + +#: templates/js_translations.html:20 +msgid "occurrences" +msgstr "gebeurtenissen" + +#: templates/js_translations.html:21 +msgid "resolution" +msgstr "resolutie" + +#: templates/js_translations.html:24 +msgid "Reported" +msgstr "Gemeld op" + +#: templates/js_translations.html:25 +msgid "Compass direction" +msgstr "Kompasrichting" + +#: templates/js_translations.html:26 +msgid "report" +msgstr "melding" + +#: templates/js_translations.html:27 +msgid "occurrence" +msgstr "keer" + +#: templates/js_translations.html:28 +msgid "Light mode" +msgstr "Lichte modus" + +#: templates/js_translations.html:29 +msgid "Dark mode" +msgstr "Donkere modus" + +#: templates/js_translations.html:30 +msgid "Switch to light mode" +msgstr "Overschakelen naar lichte modus" + +#: templates/js_translations.html:31 +msgid "Switch to dark mode" +msgstr "Overschakelen naar donkere modus" + +#: templates/js_translations.html:32 +msgid "Loading recording…" +msgstr "Opname laden…" + +#: templates/js_translations.html:33 +msgid "Could not play this recording." +msgstr "Deze opname kan niet worden afgespeeld." + +#: templates/js_translations.html:34 +msgid "Pause recording" +msgstr "Opname pauzeren" + +#: templates/js_translations.html:35 +msgid "Playing now" +msgstr "Wordt afgespeeld" + +#: templates/js_translations.html:36 +msgid "Resume recording" +msgstr "Opname hervatten" + +#: templates/js_translations.html:37 +msgid "Paused" +msgstr "Gepauzeerd" + +#: templates/js_translations.html:38 +msgid "Replay recording" +msgstr "Opname opnieuw afspelen" + +#: templates/js_translations.html:39 +msgid "Finished" +msgstr "Afgelopen" + +#: templates/js_translations.html:40 +msgid "Buffering…" +msgstr "Bufferen…" + +#: templates/js_translations.html:41 +msgid "Could not load this recording." +msgstr "Deze opname kan niet worden geladen." \ No newline at end of file diff --git a/members/__pycache__/forms.cpython-313.pyc b/members/__pycache__/forms.cpython-313.pyc index 08e52d5..fa8d96f 100644 Binary files a/members/__pycache__/forms.cpython-313.pyc and b/members/__pycache__/forms.cpython-313.pyc differ diff --git a/members/__pycache__/language_views.cpython-313.pyc b/members/__pycache__/language_views.cpython-313.pyc new file mode 100644 index 0000000..2f3dc7d Binary files /dev/null and b/members/__pycache__/language_views.cpython-313.pyc differ diff --git a/members/__pycache__/middleware.cpython-313.pyc b/members/__pycache__/middleware.cpython-313.pyc new file mode 100644 index 0000000..8ef50fd Binary files /dev/null and b/members/__pycache__/middleware.cpython-313.pyc differ diff --git a/members/__pycache__/models.cpython-313.pyc b/members/__pycache__/models.cpython-313.pyc index 1f26496..01dba99 100644 Binary files a/members/__pycache__/models.cpython-313.pyc and b/members/__pycache__/models.cpython-313.pyc differ diff --git a/members/__pycache__/tests.cpython-313.pyc b/members/__pycache__/tests.cpython-313.pyc index b04a912..6782362 100644 Binary files a/members/__pycache__/tests.cpython-313.pyc and b/members/__pycache__/tests.cpython-313.pyc differ diff --git a/members/__pycache__/views.cpython-313.pyc b/members/__pycache__/views.cpython-313.pyc index b960a6a..a767621 100644 Binary files a/members/__pycache__/views.cpython-313.pyc and b/members/__pycache__/views.cpython-313.pyc differ diff --git a/members/forms.py b/members/forms.py index ffa9ab3..6a9bee9 100644 --- a/members/forms.py +++ b/members/forms.py @@ -18,3 +18,9 @@ class UserSettingsForm(forms.ModelForm): def clean_ntfy_url(self): return self.cleaned_data["ntfy_url"].strip() + + +class LanguageSettingsForm(forms.ModelForm): + class Meta: + model = UserSettings + fields = ["preferred_language"] diff --git a/members/language_views.py b/members/language_views.py new file mode 100644 index 0000000..6e024a4 --- /dev/null +++ b/members/language_views.py @@ -0,0 +1,11 @@ +from django.conf import settings +from django.http import HttpResponseBadRequest, HttpResponseForbidden +from django.views.i18n import set_language + + +def set_anonymous_language(request): + if request.user.is_authenticated: + return HttpResponseForbidden() + if request.method != "POST" or request.POST.get("language") not in dict(settings.LANGUAGES): + return HttpResponseBadRequest() + return set_language(request) diff --git a/members/middleware.py b/members/middleware.py new file mode 100644 index 0000000..9b3b88d --- /dev/null +++ b/members/middleware.py @@ -0,0 +1,24 @@ +from django.conf import settings +from django.utils import translation + +from .models import UserSettings + + +class UserLanguageMiddleware: + """Give an authenticated user's saved choice precedence over request negotiation.""" + + def __init__(self, get_response): + self.get_response = get_response + + def __call__(self, request): + if request.user.is_authenticated: + language = UserSettings.objects.filter(user=request.user).values_list( + "preferred_language", flat=True + ).first() + language = language if language in dict(settings.LANGUAGES) else settings.LANGUAGE_CODE + else: + cookie_language = request.COOKIES.get(settings.LANGUAGE_COOKIE_NAME) + language = cookie_language if cookie_language in dict(settings.LANGUAGES) else settings.LANGUAGE_CODE + with translation.override(language): + request.LANGUAGE_CODE = language + return self.get_response(request) diff --git a/members/migrations/0003_usersettings_preferred_language.py b/members/migrations/0003_usersettings_preferred_language.py new file mode 100644 index 0000000..7086f2f --- /dev/null +++ b/members/migrations/0003_usersettings_preferred_language.py @@ -0,0 +1,13 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [('members', '0002_usersettings')] + + operations = [ + migrations.AddField( + model_name='usersettings', + name='preferred_language', + field=models.CharField(choices=[('nl', 'Nederlands'), ('en', 'English')], default='nl', max_length=2), + ), + ] diff --git a/members/migrations/__pycache__/0003_usersettings_preferred_language.cpython-313.pyc b/members/migrations/__pycache__/0003_usersettings_preferred_language.cpython-313.pyc new file mode 100644 index 0000000..f0e1721 Binary files /dev/null and b/members/migrations/__pycache__/0003_usersettings_preferred_language.cpython-313.pyc differ diff --git a/members/models.py b/members/models.py index 951b3e6..702c26c 100644 --- a/members/models.py +++ b/members/models.py @@ -1,5 +1,6 @@ from django.conf import settings from django.db import models +from django.utils.translation import gettext_lazy as _ # Create your models here. class Member(models.Model): @@ -12,16 +13,19 @@ class Member(models.Model): return f"{self.first_name} {self.last_name}" class UserSettings(models.Model): - """Per-user configuration for optional notification providers.""" + """Per-user application preferences.""" + + LANGUAGE_CHOICES = [("nl", "Nederlands"), ("en", "English")] user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="notification_settings") ntfy_url = models.URLField(blank=True) ntfy_enabled = models.BooleanField(default=False) ntfy_last_tested_at = models.DateTimeField(null=True, blank=True) + preferred_language = models.CharField(max_length=2, choices=LANGUAGE_CHOICES, default="nl") class Meta: - verbose_name = "User settings" - verbose_name_plural = "User settings" + verbose_name = _("User settings") + verbose_name_plural = _("User settings") def __str__(self): - return f"Notification settings for {self.user}" + return _("Settings for %(user)s") % {"user": self.user} diff --git a/members/templates/hello-form.html b/members/templates/hello-form.html index 0b99997..efcfd58 100644 --- a/members/templates/hello-form.html +++ b/members/templates/hello-form.html @@ -1,29 +1,29 @@ -{% load vite %} +{% load i18n vite %} - + - Hello + {% trans "Hello" %} {% vite_asset "frontend/src/entries/member-form.js" %} - +{% include "js_translations.html" %}
-

✦ A warm welcome

-

What’s your name?

-

Enter your name below and we’ll say hello.

+

✦ {% trans "A warm welcome" %}

+

{% trans "What’s your name?" %}

+

{% trans "Enter your name below and we’ll say hello." %}

{% csrf_token %} {{ form.as_p }} - +
{% if message %}

{{ message }}

{% endif %}
- Toon leden + {% trans "Show members" %}
- \ No newline at end of file + diff --git a/members/templates/members-list.html b/members/templates/members-list.html index 21bd01d..703e739 100644 --- a/members/templates/members-list.html +++ b/members/templates/members-list.html @@ -1,12 +1,12 @@ -{% load vite %} +{% load i18n vite %} - + - Members + {% trans "Members" %} {% vite_asset "frontend/src/entries/member-list.js" %} - +{% include "js_translations.html" %}
@@ -14,13 +14,13 @@

✦ - Member directory + {% trans "Member directory" %}

-

All members

-

A complete overview of everyone currently registered in the database.

+

{% trans "All members" %}

+

{% trans "A complete overview of everyone currently registered in the database." %}

-

{{ members|length }} member{{ members|length|pluralize }}

+

{% blocktrans count count=members|length %}{{ count }} member{% plural %}{{ count }} members{% endblocktrans %}

@@ -30,9 +30,9 @@ - - - + + + @@ -56,15 +56,15 @@ {% else %}
◎
-

No members yet

-

Add the first member to see them here.

+

{% trans "No members yet" %}

+

{% trans "Add the first member to see them here." %}

{% endif %}
- Open nog een formulier + {% trans "Open another form" %} - \ No newline at end of file + diff --git a/members/templates/members/login.html b/members/templates/members/login.html index fb00941..25249c6 100644 --- a/members/templates/members/login.html +++ b/members/templates/members/login.html @@ -1,30 +1,30 @@ -{% load vite %} +{% load i18n vite %} - + - Sign in · Sound Signal + {% trans "Sign in · Sound Signal" %} {% vite_asset "frontend/src/entries/login.js" %} - +{% include "js_translations.html" %}

✦ Sound Signal

-

Sign in

-

Sign in to manage your notification settings.

+

{% trans "Sign in" %}

+

{% trans "Sign in to manage your notification settings." %}

{% if form.errors %} -
Your username and password did not match. Please try again.
+
{% trans "Your username and password did not match. Please try again." %}
{% endif %}
{% csrf_token %} - + {{ form.username }} - + {{ form.password }} {% if next %}{% endif %} - + -

You will return to the page you requested.

+

{% trans "You will return to the page you requested." %}

diff --git a/members/templates/members/ntfy_test_result.html b/members/templates/members/ntfy_test_result.html index e098109..01c4db5 100644 --- a/members/templates/members/ntfy_test_result.html +++ b/members/templates/members/ntfy_test_result.html @@ -1 +1,2 @@ -{% if success %}
✓ Test notification sent successfully.
{% else %}
Could not send the test notification: {{ error }}
{% endif %} +{% load i18n %} +{% if success %}
✓ {% trans "Test notification sent successfully." %}
{% else %}
{% blocktrans %}Could not send the test notification:{% endblocktrans %} {{ error }}
{% endif %} diff --git a/members/templates/members/user_settings.html b/members/templates/members/user_settings.html index e0c1094..aec5e75 100644 --- a/members/templates/members/user_settings.html +++ b/members/templates/members/user_settings.html @@ -1,31 +1,41 @@ -{% load vite %} +{% load i18n vite %} - + - Settings · Sound Signal + {% trans "Settings · Sound Signal" %} {% vite_asset "frontend/src/entries/settings.js" %} - +{% include "js_translations.html" %}
-

Settings

-

Manage personal notification preferences.

+

{% trans "Settings" %}

+

{% trans "Manage your personal preferences." %}

{% if messages %}
    {% for message in messages %}
  • {{ message }}
  • {% endfor %}
{% endif %} +
+ {% csrf_token %} +
+

{% trans "Language" %}

+ + {{ language_form.preferred_language }} + {{ language_form.preferred_language.errors }} +
+ +
{% csrf_token %}
-

Notifications / ntfy

-

Use a topic URL from your ntfy server. Test the current URL before saving it.

- +

{% trans "Notifications / ntfy" %}

+

{% trans "Use a topic URL from your ntfy server. Test the current URL before saving it." %}

+ {{ form.ntfy_url }} {{ form.ntfy_url.errors }} -
{{ form.ntfy_enabled }}
- +
{{ form.ntfy_enabled }}
+
- +
diff --git a/members/templates/success-form.html b/members/templates/success-form.html index 532af00..acbc528 100644 --- a/members/templates/success-form.html +++ b/members/templates/success-form.html @@ -1,25 +1,25 @@ -{% load vite %} +{% load i18n vite %} - + - Hello + {% trans "Hello" %} {% vite_asset "frontend/src/entries/member-success.js" %} - +{% include "js_translations.html" %}
-

✦ A warm welcome

-

What’s your name?

-

Toegevoegt aan de database.

+

✦ {% trans "A warm welcome" %}

+

{% trans "What’s your name?" %}

+

{% trans "Added to the database." %}

{% if message %}

{{ message }}

{% endif %} - Open nog een formulier - Toon leden + {% trans "Open another form" %} + {% trans "Show members" %}
- \ No newline at end of file + diff --git a/members/tests.py b/members/tests.py index ed7b6f7..78d80b4 100644 --- a/members/tests.py +++ b/members/tests.py @@ -3,8 +3,10 @@ from unittest.mock import MagicMock, patch from urllib.error import HTTPError, URLError from django.contrib.auth import get_user_model +from django.conf import settings from django.test import SimpleTestCase, TestCase from django.urls import reverse +from django.utils import translation from notifications.services import NotificationError, send_notification, send_ntfy_notification @@ -57,7 +59,7 @@ class UserSettingsNtfyTests(TestCase): response = self.client.post(reverse("ntfy_test_notification"), {"ntfy_url": "not a URL"}) self.assertEqual(response.status_code, 400) - self.assertContains(response, "valid HTTP or HTTPS", status_code=400) + self.assertContains(response, "geldige HTTP- of HTTPS-URL", status_code=400) mock_send.assert_not_called() @patch("members.views.send_ntfy_notification") @@ -65,11 +67,11 @@ class UserSettingsNtfyTests(TestCase): response = self.client.post(reverse("ntfy_test_notification"), {"ntfy_url": self.url}) self.assertEqual(response.status_code, 200) - self.assertContains(response, "Test notification sent successfully") + self.assertContains(response, "Testmelding verzonden") mock_send.assert_called_once_with( self.url, - title="Fireworks Detector", - message="ntfy notifications are configured correctly.", + title="Vuurwerkdetector", + message="ntfy-meldingen zijn goed ingesteld.", ) @patch("members.views.send_ntfy_notification", side_effect=NotificationError("Connection to the ntfy server timed out.")) @@ -83,7 +85,7 @@ class UserSettingsNtfyTests(TestCase): response = self.client.post(reverse("user_settings"), {"ntfy_url": self.url, "ntfy_enabled": "on"}) self.assertEqual(response.status_code, 200) - self.assertContains(response, "Test this URL successfully") + self.assertContains(response, "Test deze URL") settings = UserSettings.objects.get(user=self.user) self.assertFalse(settings.ntfy_enabled) self.assertEqual(settings.ntfy_url, "") @@ -109,7 +111,7 @@ class UserSettingsNtfyTests(TestCase): response = self.client.post(reverse("user_settings"), {"ntfy_url": changed_url, "ntfy_enabled": "on"}) self.assertEqual(response.status_code, 200) - self.assertContains(response, "Test this URL successfully") + self.assertContains(response, "Test deze URL") self.assertEqual(UserSettings.objects.get(user=self.user).ntfy_url, self.url) @patch("members.views.send_ntfy_notification") @@ -120,7 +122,7 @@ class UserSettingsNtfyTests(TestCase): response = self.client.post(reverse("user_settings"), {"ntfy_url": self.url, "ntfy_enabled": "on"}) self.assertEqual(response.status_code, 200) - self.assertContains(response, "Test this URL successfully") + self.assertContains(response, "Test deze URL") settings = UserSettings.objects.get(user=self.other_user) self.assertFalse(settings.ntfy_enabled) @@ -135,6 +137,7 @@ class UserSettingsNtfyTests(TestCase): class FrontendAuthenticationTests(TestCase): def setUp(self): + self.client.cookies[settings.LANGUAGE_COOKIE_NAME] = "en" self.user = get_user_model().objects.create_user(username="profile-user", password="secret") def test_frontend_login_page_is_available(self): @@ -162,3 +165,106 @@ class FrontendAuthenticationTests(TestCase): authenticated_response = self.client.get(reverse("hello")) self.assertContains(authenticated_response, "class=\"profile-circle\"") self.assertContains(authenticated_response, reverse("user_settings")) + + +class LanguageSettingsTests(TestCase): + def setUp(self): + self.user = get_user_model().objects.create_user(username="language-user", password="secret") + self.client.force_login(self.user) + + def test_missing_settings_row_uses_dutch_and_page_displays_it(self): + response = self.client.get(reverse("user_settings")) + self.assertEqual(response.status_code, 200) + self.assertContains(response, '
MemberPhone numberJoined{% trans "Member" %}{% trans "Phone number" %}{% trans "Joined" %}