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

@ -2,18 +2,18 @@
{% block content %}
<div class="section">
<h2>Loan History</h2>
<h2>{{ _('Loan History') }}</h2>
{% if loans %}
<div class="table-container">
<table>
<thead>
<tr>
<th>Tablet</th>
<th>Serial Number</th>
<th>Borrower</th>
<th>Loan Date</th>
<th>Return Date</th>
<th>Status</th>
<th>{{ _('Tablet') }}</th>
<th>{{ _('Serial Number') }}</th>
<th>{{ _('Borrower') }}</th>
<th>{{ _('Loan Date') }}</th>
<th>{{ _('Return Date') }}</th>
<th>{{ _('Status') }}</th>
</tr>
</thead>
<tbody>
@ -31,7 +31,7 @@
</table>
</div>
{% else %}
<p>No loan history available.</p>
<p>{{ _('No loan history available.') }}</p>
{% endif %}
</div>
{% endblock %}
{% endblock %}