diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-06-08 01:43:08 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-06-08 01:44:03 +0200 |
| commit | 6bd0c135a877627c2d730649824dee7d5bfa6b08 (patch) | |
| tree | 66f784649904e1561078d5a964e685f0d821da01 /server/api/src | |
| parent | a60c0f58470f78545544d01d525eae481511abec (diff) | |
Add translation module
Reads from a list of grit files, all strings and their translations.
Diffstat (limited to 'server/api/src')
| -rw-r--r-- | server/api/src/api_model.rs | 38 |
1 files changed, 38 insertions, 0 deletions
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<UserKey>, } + +#[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<LocalizationPlaceholder>, + pub placeholder_offset: Vec<usize>, + #[schema(example = "123456")] + pub translation_id: i64, + pub translations: Vec<TranslationString>, +} + +#[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<usize>, +} |
