From 6bd0c135a877627c2d730649824dee7d5bfa6b08 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sun, 8 Jun 2025 01:43:08 +0200 Subject: Add translation module Reads from a list of grit files, all strings and their translations. --- server/api/src/api_model.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'server/api/src') diff --git a/server/api/src/api_model.rs b/server/api/src/api_model.rs index 7602480..7dd2a20 100644 --- a/server/api/src/api_model.rs +++ b/server/api/src/api_model.rs @@ -265,3 +265,41 @@ pub struct UserKeys { pub more: bool, pub keys: Vec, } + +#[derive(Debug, Deserialize, PartialEq, Serialize, ToSchema)] +pub struct LocalizationString { + #[schema(example = "IDS_GENERIC_WELCOME")] + pub id: String, + #[schema(example = "strings/strings.grd")] + pub file: String, + #[schema(example = "Generic greating")] + pub description: String, + #[schema(example = "This should be a positive greating")] + pub meaning: String, + #[schema(example = "Hello!")] + pub source: String, + pub placeholders: Vec, + pub placeholder_offset: Vec, + #[schema(example = "123456")] + pub translation_id: i64, + pub translations: Vec, +} + +#[derive(Debug, Deserialize, PartialEq, Serialize, ToSchema)] +pub struct LocalizationPlaceholder { + #[schema(example = "NAME")] + pub id: String, + #[schema(example = "%1$d")] + pub content: String, + #[schema(example = "42")] + pub example: String, +} + +#[derive(Debug, Deserialize, PartialEq, Serialize, ToSchema)] +pub struct TranslationString { + #[schema(example = "sv")] + pub language: String, + #[schema(example = "Hej!")] + pub translation: String, + pub placeholder_offset: Vec, +} -- cgit v1.2.3-70-g09d2