Some checks failed
ci/woodpecker/pr/pipeline Pipeline failed
Add i18n support to the blog web UI with 4 languages (en/ru/fr/de),
80 translation keys, automatic Accept-Language detection, persistent
locale cookie, and a language switcher dropdown in the header.
- Infrastructure: TranslationService, translation dicts, convenience _()
- Presentation: locale middleware, /web/lang/{locale} switcher route
- Templates: all 9 templates use {{ _(key, current_locale) }}
- Tests: 26 tests across TranslationService, locale detection helpers
- Docs: TEST_MODEL.md and FEATURE_INFRASTRUCTURE.md updated with TC-UNIT-811-821
185 lines
6.0 KiB
HTML
185 lines
6.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="{{ current_locale }}" data-testid="html-root">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="{% block meta_description %}{{ _('base.meta_description', current_locale) }}{% endblock %}">
|
|
<meta name="keywords" content="{% block meta_keywords %}{{ _('base.meta_keywords', current_locale) }}{% endblock %}">
|
|
<meta name="author" content="{% block meta_author %}{{ _('base.meta_author', current_locale) }}{% endblock %}">
|
|
<meta name="robots" content="{% block meta_robots %}index, follow{% endblock %}">
|
|
|
|
<!-- Canonical URL -->
|
|
<link rel="canonical" href="{% block canonical_url %}{{ request.url }}{% endblock %}">
|
|
|
|
<!-- Open Graph / Facebook -->
|
|
<meta property="og:type" content="{% block og_type %}website{% endblock %}">
|
|
<meta property="og:url" content="{% block og_url %}{{ request.url }}{% endblock %}">
|
|
<meta property="og:title" content="{% block og_title %}{{ self.title() }}{% endblock %}">
|
|
<meta property="og:description" content="{% block og_description %}{{ self.meta_description() }}{% endblock %}">
|
|
<meta property="og:image" content="{% block og_image %}{{ request.base_url }}static/images/og-default.png{% endblock %}">
|
|
<meta property="og:site_name" content="Blog">
|
|
|
|
<!-- Twitter -->
|
|
<meta property="twitter:card" content="{% block twitter_card %}summary_large_image{% endblock %}">
|
|
<meta property="twitter:url" content="{% block twitter_url %}{{ request.url }}{% endblock %}">
|
|
<meta property="twitter:title" content="{% block twitter_title %}{{ self.title() }}{% endblock %}">
|
|
<meta property="twitter:description" content="{% block twitter_description %}{{ self.meta_description() }}{% endblock %}">
|
|
<meta property="twitter:image" content="{% block twitter_image %}{{ self.og_image() }}{% endblock %}">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="icon" type="image/svg+xml" href="/static/images/favicon.svg">
|
|
<link rel="alternate icon" href="/static/images/favicon.ico">
|
|
|
|
<title data-testid="page-title">{% block title %}{{ _('base.default_title', current_locale) }}{% endblock %}</title>
|
|
|
|
<link rel="stylesheet" href="/static/css/themes/theme-light.css" data-testid="theme-light-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/themes/theme-dark.css" data-testid="theme-dark-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/base.css" data-testid="base-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/components.css" data-testid="components-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/layout.css" data-testid="layout-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/markdown.css" data-testid="markdown-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/pygments.css" data-testid="pygments-stylesheet">
|
|
|
|
{% block extra_css %}{% endblock %}
|
|
</head>
|
|
<body data-testid="body">
|
|
{% include "partials/header.html" %}
|
|
|
|
<!-- Flash Messages -->
|
|
{% if flash_messages %}
|
|
<div class="flash-container" data-testid="flash-container">
|
|
{% for msg in flash_messages %}
|
|
<div class="flash-message flash-{{ msg.category }}" data-testid="flash-message-{{ msg.category }}" role="alert">
|
|
<span class="flash-text" data-testid="flash-text">{{ msg.message }}</span>
|
|
<button type="button" class="flash-close" data-testid="flash-close" aria-label="{{ _('base.close_message', current_locale) }}">×</button>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<main class="main-wrapper" data-testid="main-content">
|
|
<div class="container" data-testid="container">
|
|
{% block content %}{% endblock %}
|
|
</div>
|
|
</main>
|
|
|
|
{% include "partials/footer.html" %}
|
|
|
|
<script src="/static/js/theme.js" data-testid="theme-script"></script>
|
|
<script src="/static/js/flash.js" data-testid="flash-script"></script>
|
|
{% block extra_js %}{% endblock %}
|
|
</body>
|
|
</html>
|
|
|
|
<style>
|
|
.flash-container {
|
|
position: fixed;
|
|
top: 5rem;
|
|
right: 1rem;
|
|
z-index: 1000;
|
|
max-width: 400px;
|
|
width: calc(100% - 2rem);
|
|
}
|
|
|
|
.flash-message {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
padding: 1rem 1.25rem;
|
|
margin-bottom: 0.75rem;
|
|
border-radius: 8px;
|
|
border: 1px solid transparent;
|
|
box-shadow: 0 4px 12px var(--color-shadow);
|
|
animation: slideIn 0.3s ease;
|
|
}
|
|
|
|
@keyframes slideIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateX(100%);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateX(0);
|
|
}
|
|
}
|
|
|
|
.flash-message.fade-out {
|
|
animation: slideOut 0.3s ease forwards;
|
|
}
|
|
|
|
@keyframes slideOut {
|
|
from {
|
|
opacity: 1;
|
|
transform: translateX(0);
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
transform: translateX(100%);
|
|
}
|
|
}
|
|
|
|
.flash-success {
|
|
background-color: var(--color-success-bg);
|
|
border-color: var(--color-success-border);
|
|
color: var(--color-success-text);
|
|
}
|
|
|
|
.flash-error {
|
|
background-color: var(--color-error-bg);
|
|
border-color: var(--color-error-border);
|
|
color: var(--color-error-text);
|
|
}
|
|
|
|
.flash-warning {
|
|
background-color: var(--color-warning-bg);
|
|
border-color: var(--color-warning-border);
|
|
color: var(--color-warning-text);
|
|
}
|
|
|
|
.flash-info {
|
|
background-color: var(--color-info-bg);
|
|
border-color: var(--color-info-border);
|
|
color: var(--color-info-text);
|
|
}
|
|
|
|
.flash-text {
|
|
flex: 1;
|
|
font-size: 0.9375rem;
|
|
}
|
|
|
|
.flash-close {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 1.5rem;
|
|
height: 1.5rem;
|
|
padding: 0;
|
|
background: transparent;
|
|
border: none;
|
|
color: inherit;
|
|
font-size: 1.25rem;
|
|
cursor: pointer;
|
|
opacity: 0.6;
|
|
transition: opacity 0.2s ease;
|
|
}
|
|
|
|
.flash-close:hover {
|
|
opacity: 1;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.flash-container {
|
|
top: 4rem;
|
|
left: 1rem;
|
|
right: 1rem;
|
|
max-width: none;
|
|
}
|
|
|
|
.flash-message {
|
|
padding: 0.875rem 1rem;
|
|
}
|
|
}
|
|
</style>
|