diff --git a/rust/agama-dbus-server/src/locale/locale.rs b/rust/agama-dbus-server/src/locale/locale.rs index 4c85c43151..c6c446dd99 100644 --- a/rust/agama-dbus-server/src/locale/locale.rs +++ b/rust/agama-dbus-server/src/locale/locale.rs @@ -33,7 +33,7 @@ impl LocalesDatabase { /// Loads the list of locales. /// - /// * `locale`: locale to translate the descriptions. + /// * `ui_language`: language to translate the descriptions (e.g., "en"). pub fn read(&mut self, ui_language: &str) -> Result<(), Error> { let result = Command::new("/usr/bin/localectl") .args(["list-locales"]) diff --git a/rust/agama-dbus-server/src/locale/timezone.rs b/rust/agama-dbus-server/src/locale/timezone.rs index 61af050a6f..74c9aa6671 100644 --- a/rust/agama-dbus-server/src/locale/timezone.rs +++ b/rust/agama-dbus-server/src/locale/timezone.rs @@ -23,6 +23,8 @@ impl TimezonesDatabase { } /// Initializes the list of known timezones. + /// + /// * `ui_language`: language to translate the descriptions (e.g., "en"). pub fn read(&mut self, ui_language: &str) -> Result<(), Error> { self.timezones = self.get_timezones(ui_language)?; Ok(()) @@ -42,14 +44,14 @@ impl TimezonesDatabase { /// Each element of the list contains a timezone identifier and a vector /// containing the translation of each part of the language. /// - /// * `locale`: locale to use in the translations. - fn get_timezones(&self, locale: &str) -> Result, Error> { + /// * `ui_language`: language to translate the descriptions (e.g., "en"). + fn get_timezones(&self, ui_language: &str) -> Result, Error> { let timezones = agama_locale_data::get_timezones(); let tz_parts = agama_locale_data::get_timezone_parts()?; let ret = timezones .into_iter() .map(|tz| { - let parts = translate_parts(&tz, &locale, &tz_parts); + let parts = translate_parts(&tz, &ui_language, &tz_parts); TimezoneEntry { code: tz, parts } }) .collect(); @@ -57,12 +59,12 @@ impl TimezonesDatabase { } } -fn translate_parts(timezone: &str, locale: &str, tz_parts: &TimezoneIdParts) -> Vec { +fn translate_parts(timezone: &str, ui_language: &str, tz_parts: &TimezoneIdParts) -> Vec { timezone .split("/") .map(|part| { tz_parts - .localize_part(part, &locale) + .localize_part(part, &ui_language) .unwrap_or(part.to_owned()) }) .collect()