aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-02-10 06:54:25 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2024-02-10 06:54:25 +0000
commit88fa09755ff31b39b0454f0da58bc41a90263e89 (patch)
tree31e91e27324366bbea20b4af2a17ec10f73322e9 /src/templates.rs
parent205a71efa9f60938c86d57bba07f6d33b21790a2 (diff)
downloadblossom-88fa09755ff31b39b0454f0da58bc41a90263e89.tar.gz
blossom-88fa09755ff31b39b0454f0da58bc41a90263e89.tar.bz2
blossom-88fa09755ff31b39b0454f0da58bc41a90263e89.zip
add initial localisation
Diffstat (limited to '')
-rw-r--r--src/templates.rs22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/templates.rs b/src/templates.rs
index 4bcb64b..2ab9c41 100644
--- a/src/templates.rs
+++ b/src/templates.rs
@@ -2,6 +2,7 @@ use std::collections::HashSet;
use askama::Template;
use poem::http::StatusCode;
+use poem::i18n::Locale;
use rand::{thread_rng, Rng};
use crate::poetry;
@@ -17,55 +18,66 @@ mod filters {
}
#[derive(Template)]
-#[template(path = "base.html")]
-struct Base;
-
-#[derive(Template)]
#[template(path = "home.html")]
pub struct Home {
+ pub title: String,
pub is_live: bool,
pub listenbrainz: NowPlayingData,
pub blogposts: Vec<blog::Blogpost>,
pub poem: Option<poetry::Poem>,
+ pub locale: Locale,
}
#[derive(Template)]
#[template(path = "blogpost.html")]
pub struct Blogpost {
+ pub title: String,
pub blogpost: blog::Blogpost,
pub filter_tags: HashSet<String>,
+ pub locale: Locale,
}
// filtertags, blogpost-panel
#[derive(Template)]
#[template(path = "blog.html")]
pub struct Blog {
+ pub title: String,
pub blogposts: Vec<blog::Blogpost>,
pub tags: Vec<String>,
pub filter_tags: HashSet<String>,
+ pub locale: Locale,
}
#[derive(Template)]
#[template(path = "poem.html")]
pub struct Poem {
+ pub title: String,
pub poem: poetry::Poem,
pub jiggle: isize,
+ pub locale: Locale,
}
#[derive(Template)]
#[template(path = "poetry.html")]
pub struct Poetry {
+ pub title: String,
pub poems: Vec<poetry::Poem>,
pub jiggle: isize,
+ pub locale: Locale,
}
#[derive(Template)]
#[template(path = "contact.html")]
-pub struct Contact;
+pub struct Contact {
+ pub title: String,
+ pub locale: Locale,
+}
#[derive(Template)]
#[template(path = "error.html")]
pub struct Error {
+ pub title: String,
pub status: StatusCode,
pub message: String,
+ // TODO: localize error page
}