From 78609dec9a928b701ed0125cbc1e9e0098b99c31 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 26 May 2024 15:23:23 +0200 Subject: [PATCH] translate question --- src/iotro.rs | 12 +++++++++--- src/question.rs | 16 ++-------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/iotro.rs b/src/iotro.rs index 98b5a50..22f5c1d 100644 --- a/src/iotro.rs +++ b/src/iotro.rs @@ -24,7 +24,9 @@ pub struct Language<'a> { download_videos: &'a str, questions_feedback: &'a str, // metadata - pub(crate) from: &'a str + pub(crate) from: &'a str, + // questions + pub(crate) question: &'a str } pub const GERMAN: Language<'static> = Language { @@ -58,7 +60,9 @@ pub const GERMAN: Language<'static> = Language { download_videos: "Videos herunterladen", questions_feedback: "Fragen, Vorschläge und Feedback", - from: "vom" + from: "vom", + + question: "Frage" }; pub const BRITISH: Language<'static> = Language { @@ -98,7 +102,9 @@ pub const BRITISH: Language<'static> = Language { download_videos: "Download videos", questions_feedback: "Questions, Suggestions and Feedback", - from: "from" + from: "from", + + question: "Question" }; impl Default for Language<'static> { diff --git a/src/question.rs b/src/question.rs index 0d7e3fc..53908f9 100644 --- a/src/question.rs +++ b/src/question.rs @@ -3,7 +3,7 @@ use fontconfig::Fontconfig; use harfbuzz_rs::{Face, Font, Owned, UnicodeBuffer}; use std::sync::OnceLock; use svgwriter::{ - tags::{Group, Path, Rect, TSpan, TagWithPresentationAttributes as _, Text}, + tags::{Group, Path, TSpan, TagWithPresentationAttributes as _, Text}, Data, Graphic, Transform }; @@ -122,7 +122,7 @@ impl Question { .with_dominant_baseline("middle") .with_text_anchor("middle") .with_font_weight(600) - .append("Question") + .append(lang.question.to_owned()) ); g.push(text); @@ -138,15 +138,3 @@ impl Question { 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(); -}