diff --git a/rust/agama-server/src/l10n/keyboard.rs b/rust/agama-server/src/l10n/keyboard.rs index a10c202ff..775ea052a 100644 --- a/rust/agama-server/src/l10n/keyboard.rs +++ b/rust/agama-server/src/l10n/keyboard.rs @@ -20,16 +20,13 @@ use agama_locale_data::{get_localectl_keymaps, keyboard::XkbConfigRegistry, KeymapId}; use gettextrs::*; -use serde::Serialize; -use serde_with::{serde_as, DisplayFromStr}; +use serde::ser::{Serialize, SerializeStruct}; use std::collections::HashMap; -#[serde_as] // Minimal representation of a keymap -#[derive(Clone, Debug, Serialize, utoipa::ToSchema)] +#[derive(Clone, Debug, utoipa::ToSchema)] pub struct Keymap { /// Keymap identifier (e.g., "us") - #[serde_as(as = "DisplayFromStr")] pub id: KeymapId, /// Keymap description description: String, @@ -48,6 +45,18 @@ impl Keymap { } } +impl Serialize for Keymap { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let mut state = serializer.serialize_struct("Keymap", 2)?; + state.serialize_field("id", &self.id.to_string())?; + state.serialize_field("description", &self.localized_description())?; + state.end() + } +} + /// Represents the keymaps database. /// /// The list of supported keymaps is read from `systemd-localed` and the diff --git a/rust/package/agama.changes b/rust/package/agama.changes index 4541f3dcd..b7951148c 100644 --- a/rust/package/agama.changes +++ b/rust/package/agama.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Sep 27 10:44:22 UTC 2024 - Imobach Gonzalez Sosa + +- Expose keymaps localized descriptions (gh#agama-project/agama#1643). + ------------------------------------------------------------------- Wed Sep 25 14:33:50 UTC 2024 - Clemens Famulla-Conrad