Skip to content

Commit

Permalink
Set the default language to the system's one
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Nov 30, 2023
1 parent ca644a1 commit 6119c0b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rust/agama-dbus-server/src/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ impl Locale {
let locale = ui_locale.to_string();
let mut locales_db = LocalesDatabase::new();
locales_db.read(&locale)?;
let default_locale = locales_db.entries().get(0).unwrap();

let default_locale = if locales_db.exists(locale.as_str()) {
ui_locale.to_string()
} else {
// TODO: handle the case where the database is empty (not expected!)
locales_db.entries().get(0).unwrap().code.to_string()
};

let mut timezones_db = TimezonesDatabase::new();
timezones_db.read(&locale)?;
Expand All @@ -191,7 +197,7 @@ impl Locale {
let locale = Self {
keymap: "us".parse().unwrap(),
timezone: default_timezone.code.to_string(),
locales: vec![default_locale.code.to_string()],
locales: vec![default_locale],
locales_db,
timezones_db,
keymaps_db,
Expand Down

0 comments on commit 6119c0b

Please sign in to comment.