Implementing multi-language Admin UI
build / build-linux-amd64 (push) Successful in 2m2s

This commit is contained in:
2026-05-09 16:58:20 +02:00
parent a7b3e83f02
commit 1e961cdd92
14 changed files with 2989 additions and 487 deletions
+5 -3
View File
@@ -3,14 +3,16 @@
//! the cookie isn't valid, the AuthedUser extractor 401s and the page-level
//! HTMX response handler bounces back to the login form.
use crate::api::admin::i18n::{t, Lang};
use crate::api::error::ApiError;
use crate::api::middleware::AuthedUser;
use axum::response::Html;
pub async fn me(user: AuthedUser) -> Result<Html<String>, ApiError> {
pub async fn me(user: AuthedUser, lang: Lang) -> Result<Html<String>, ApiError> {
Ok(Html(format!(
"Signed in as <span class=\"text-slate-300\">{}</span>",
html_escape(&user.name)
"{label} <span class=\"text-slate-300\">{name}</span>",
label = t(lang, "nav.signed_in_as"),
name = html_escape(&user.name),
)))
}