Add i18n support for French and German with browser language detection
CI / test-and-package (push) Successful in 35s

This commit is contained in:
agentbox
2026-08-01 06:00:29 +00:00
parent 218e2b6fb0
commit b46691fee3
9 changed files with 519 additions and 78 deletions
+13 -5
View File
@@ -1,19 +1,19 @@
<!doctype html>
<html lang="en">
<html lang="{{ lang }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Meal Tracker{% endblock %}</title>
<title>{% block title %}{{ t('Meal Tracker') }}{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<nav class="navbar">
<span class="brand">🍽 Meal Tracker</span>
<span class="brand">🍽 {{ t('Meal Tracker') }}</span>
{% if session.user_id %}
<div class="nav-right">
<span class="nav-household">{{ session.household_name }}</span>
<span class="nav-user">{{ session.username }}{% if session.is_admin %} (admin){% endif %}</span>
<a class="btn btn-sm" href="{{ url_for('auth.logout') }}">Logout</a>
<span class="nav-user">{{ session.username }}{% if session.is_admin %} ({{ t('admin') }}){% endif %}</span>
<a class="btn btn-sm" href="{{ url_for('auth.logout') }}">{{ t('Logout') }}</a>
</div>
{% endif %}
</nav>
@@ -31,5 +31,13 @@
{% block content %}{% endblock %}
</main>
<footer class="lang-footer">
{% for code, name in {'en': 'English', 'fr': 'Français', 'de': 'Deutsch'}.items() %}
<a href="?lang={{ code }}"
class="lang-link{% if lang == code %} lang-active{% endif %}"
aria-label="{{ name }}">{{ code.upper() }}</a>
{% endfor %}
</footer>
</body>
</html>