translate question

This commit is contained in:
Dominic 2024-05-26 15:23:23 +02:00
parent 1dfe835587
commit 78609dec9a
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
2 changed files with 11 additions and 17 deletions

View file

@ -24,7 +24,9 @@ pub struct Language<'a> {
download_videos: &'a str, download_videos: &'a str,
questions_feedback: &'a str, questions_feedback: &'a str,
// metadata // metadata
pub(crate) from: &'a str pub(crate) from: &'a str,
// questions
pub(crate) question: &'a str
} }
pub const GERMAN: Language<'static> = Language { pub const GERMAN: Language<'static> = Language {
@ -58,7 +60,9 @@ pub const GERMAN: Language<'static> = Language {
download_videos: "Videos herunterladen", download_videos: "Videos herunterladen",
questions_feedback: "Fragen, Vorschläge und Feedback", questions_feedback: "Fragen, Vorschläge und Feedback",
from: "vom" from: "vom",
question: "Frage"
}; };
pub const BRITISH: Language<'static> = Language { pub const BRITISH: Language<'static> = Language {
@ -98,7 +102,9 @@ pub const BRITISH: Language<'static> = Language {
download_videos: "Download videos", download_videos: "Download videos",
questions_feedback: "Questions, Suggestions and Feedback", questions_feedback: "Questions, Suggestions and Feedback",
from: "from" from: "from",
question: "Question"
}; };
impl Default for Language<'static> { impl Default for Language<'static> {

View file

@ -3,7 +3,7 @@ use fontconfig::Fontconfig;
use harfbuzz_rs::{Face, Font, Owned, UnicodeBuffer}; use harfbuzz_rs::{Face, Font, Owned, UnicodeBuffer};
use std::sync::OnceLock; use std::sync::OnceLock;
use svgwriter::{ use svgwriter::{
tags::{Group, Path, Rect, TSpan, TagWithPresentationAttributes as _, Text}, tags::{Group, Path, TSpan, TagWithPresentationAttributes as _, Text},
Data, Graphic, Transform Data, Graphic, Transform
}; };
@ -122,7 +122,7 @@ impl Question {
.with_dominant_baseline("middle") .with_dominant_baseline("middle")
.with_text_anchor("middle") .with_text_anchor("middle")
.with_font_weight(600) .with_font_weight(600)
.append("Question") .append(lang.question.to_owned())
); );
g.push(text); g.push(text);
@ -138,15 +138,3 @@ impl Question {
svg svg
} }
} }
#[cfg(test)]
#[test]
fn question() {
let svg = Question::new(
Resolution::FullHD,
&Language::default(),
"Hallo Welt! Dies ist eine sehr kluge Frage aus dem Publikum. Die Frage ist nämlich: Was ist eigentlich die Frage?".into()
)
.finish();
std::fs::write("question.svg", svg.to_string_pretty()).unwrap();
}