fix(i18n): enable translations in all templates and implement cookie-based language persistence

- Add _() translation function to add_tablet.html, add_user.html, loan_tablet.html
- Add _() translation function to add_non_loanable_device.html, edit_non_loanable_device.html
- Add _() translation function to history.html, non_loanable_devices.html, project_management.html
- Update app.py to use cookie-based language persistence with 1-year expiry
- Add /set_language endpoint to handle language switching with cookie + session
- Update language switcher in base.html to use new endpoint
- Set Spanish (es) as default language for internal app
- Import make_response and session from Flask
This commit is contained in:
ijuanes 2026-06-20 13:14:41 +01:00
parent 8c1d12a5c4
commit 2248237c79
10 changed files with 133 additions and 107 deletions

View file

@ -1,30 +1,30 @@
{% extends "base.html" %}
{% block content %}
<h2>Add New Tablet</h2>
<h2>{{ _('Add New Tablet') }}</h2>
<form method="POST" action="/add_tablet">
<div class="form-group">
<label for="brand">Brand:</label>
<label for="brand">{{ _('Brand') }}:</label>
<input type="text" id="brand" name="brand" required>
</div>
<div class="form-group">
<label for="model">Model:</label>
<label for="model">{{ _('Model') }}:</label>
<input type="text" id="model" name="model" required>
</div>
<div class="form-group">
<label for="serial_number">Serial Number:</label>
<label for="serial_number">{{ _('Serial Number') }}:</label>
<input type="text" id="serial_number" name="serial_number" required>
</div>
<div class="form-group">
<label for="notes">Notes:</label>
<label for="notes">{{ _('Notes') }}:</label>
<textarea id="notes" name="notes"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn">Add Tablet</button>
<button type="submit" class="btn">{{ _('Add Tablet') }}</button>
</div>
</form>
{% endblock %}
{% endblock %}