Languages list is now sorted.

This commit is contained in:
Greg Burri 2025-01-03 19:32:41 +01:00
parent b5919a43eb
commit 754d5ec9e3
4 changed files with 32 additions and 3 deletions

View file

@ -1,4 +1,4 @@
use std::time::Duration;
use std::{sync::LazyLock, time::Duration};
pub const FILE_CONF: &str = "conf.ron";
pub const DB_DIRECTORY: &str = "data";
@ -21,4 +21,8 @@ pub const REVERSE_PROXY_IP_HTTP_FIELD: &str = "x-real-ip"; // Set by the reverse
pub const MAX_DB_CONNECTION: u32 = 1; // To avoid database lock.
pub const LANGUAGES: [(&str, &str); 2] = [("Français", "fr"), ("English", "en")];
pub static LANGUAGES: LazyLock<[(&str, &str); 2]> = LazyLock::new(|| {
let mut langs = [("Français", "fr"), ("English", "en")];
langs.sort();
langs
});

View file

@ -47,7 +47,7 @@ pub async fn edit_recipe(
user: Some(user),
recipes,
recipe,
languages: consts::LANGUAGES,
languages: *consts::LANGUAGES,
}
.into_response())
} else {