UPDATE: Adds bindings to update timezone and locale

UPDATE: Update "generate locale" utility

FIX: Minor fixes to UI and proper support for locales/timezones

UPDATE: Adds "display language" setting to core
This commit is contained in:
Nicolás Hatcher
2025-11-28 21:21:19 +01:00
parent 402a13bd00
commit ffe5d1a158
109 changed files with 4783 additions and 3216 deletions

View File

@@ -77,6 +77,15 @@ dependencies = [
"libc",
]
[[package]]
name = "approx"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
dependencies = [
"num-traits",
]
[[package]]
name = "arrayvec"
version = "0.7.6"
@@ -925,7 +934,7 @@ dependencies = [
[[package]]
name = "ironcalc"
version = "0.5.0"
version = "0.6.0"
dependencies = [
"bitcode",
"chrono",
@@ -940,7 +949,7 @@ dependencies = [
[[package]]
name = "ironcalc_base"
version = "0.5.0"
version = "0.6.0"
dependencies = [
"bitcode",
"chrono",
@@ -951,6 +960,7 @@ dependencies = [
"regex",
"ryu",
"serde",
"statrs",
]
[[package]]
@@ -1978,6 +1988,16 @@ dependencies = [
"loom",
]
[[package]]
name = "statrs"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a3fe7c28c6512e766b0874335db33c94ad7b8f9054228ae1c2abd47ce7d335e"
dependencies = [
"approx",
"num-traits",
]
[[package]]
name = "subtle"
version = "2.6.1"

View File

@@ -27,8 +27,7 @@ pub async fn add_model(
.execute(&mut **db)
.await
.map_err(|e| {
io::Error::new(
io::ErrorKind::Other,
io::Error::other(
format!("Failed to save to the database: {}", e),
)
})?;

View File

@@ -36,14 +36,13 @@ async fn download(data: Data<'_>) -> io::Result<FileResponder> {
.await
.unwrap();
if !bytes.is_complete() {
return Err(io::Error::new(
io::ErrorKind::Other,
return Err(io::Error::other(
"The file was not fully uploaded",
));
};
let model = IModel::from_bytes(&bytes).map_err(|e| {
io::Error::new(io::ErrorKind::Other, format!("Error creating model, '{e}'"))
let model = IModel::from_bytes(&bytes, "en").map_err(|e| {
io::Error::other(format!("Error creating model, '{e}'"))
})?;
let mut buffer: Vec<u8> = Vec::new();
@@ -51,7 +50,7 @@ async fn download(data: Data<'_>) -> io::Result<FileResponder> {
let cursor = Cursor::new(&mut buffer);
let mut writer = BufWriter::new(cursor);
save_xlsx_to_writer(&model, &mut writer).map_err(|e| {
io::Error::new(io::ErrorKind::Other, format!("Error saving model: '{e}'"))
io::Error::other(format!("Error saving model: '{e}'"))
})?;
writer.flush().unwrap();
}
@@ -82,8 +81,7 @@ async fn share(db: Connection<IronCalcDB>, data: Data<'_>) -> io::Result<String>
let hash = id::new_id();
let bytes = data.open(MAX_SIZE_MB.megabytes()).into_bytes().await?;
if !bytes.is_complete() {
return Err(io::Error::new(
io::ErrorKind::Other,
return Err(io::Error::other(
"file was not fully uploaded",
));
}
@@ -111,15 +109,14 @@ async fn upload(data: Data<'_>, name: &str) -> io::Result<Vec<u8>> {
println!("start upload");
let bytes = data.open(MAX_SIZE_MB.megabytes()).into_bytes().await?;
if !bytes.is_complete() {
return Err(io::Error::new(
io::ErrorKind::Other,
return Err(io::Error::other(
"file was not fully uploaded",
));
}
let workbook = load_from_xlsx_bytes(&bytes, name.trim_end_matches(".xlsx"), "en", "UTC")
.map_err(|e| io::Error::new(io::ErrorKind::Other, format!("Error loading model: '{e}'")))?;
let model = IModel::from_workbook(workbook).map_err(|e| {
io::Error::new(io::ErrorKind::Other, format!("Error creating model: '{e}'"))
.map_err(|e| io::Error::other(format!("Error loading model: '{e}'")))?;
let model = IModel::from_workbook(workbook, "en").map_err(|e| {
io::Error::other(format!("Error creating model: '{e}'"))
})?;
println!("end upload");
Ok(model.to_bytes())