From 3d4462634f7f904e48d42e70a45620cd9f94d491 Mon Sep 17 00:00:00 2001 From: Mendy Berger <12537668+MendyBerger@users.noreply.github.com> Date: Sun, 3 Mar 2024 15:47:34 -0500 Subject: [PATCH] Started to add intl apis --- Cargo.lock | 38 +++++++--- Cargo.toml | 4 ++ crates/intl/Cargo.toml | 18 +++++ crates/intl/README.md | 24 +++++++ crates/intl/src/date_time_format.rs | 103 ++++++++++++++++++++++++++++ crates/intl/src/lib.rs | 4 ++ crates/intl/src/number_format.rs | 84 +++++++++++++++++++++++ crates/intl/src/utils.rs | 31 +++++++++ src/lib.rs | 3 + 9 files changed, 300 insertions(+), 9 deletions(-) create mode 100644 crates/intl/Cargo.toml create mode 100644 crates/intl/README.md create mode 100644 crates/intl/src/date_time_format.rs create mode 100644 crates/intl/src/lib.rs create mode 100644 crates/intl/src/number_format.rs create mode 100644 crates/intl/src/utils.rs diff --git a/Cargo.lock b/Cargo.lock index 114c8d0b..50d1f3e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -454,6 +454,7 @@ dependencies = [ "gloo-events 0.2.0", "gloo-file 0.3.0", "gloo-history 0.2.2", + "gloo-intl", "gloo-net 0.5.0", "gloo-render 0.2.0", "gloo-storage 0.3.0", @@ -588,6 +589,14 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-intl" +version = "0.1.0" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "gloo-net" version = "0.3.1" @@ -598,7 +607,7 @@ dependencies = [ "futures-core", "futures-sink", "gloo-utils 0.1.7", - "http", + "http 0.2.11", "js-sys", "pin-project", "serde", @@ -785,7 +794,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.11", "indexmap 2.1.0", "slab", "tokio", @@ -814,7 +823,7 @@ dependencies = [ "base64", "bytes", "headers-core", - "http", + "http 0.2.11", "httpdate", "mime", "sha1", @@ -826,7 +835,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "http", + "http 0.2.11", ] [[package]] @@ -852,6 +861,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -859,7 +879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.11", "pin-project-lite", ] @@ -886,7 +906,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", + "http 0.2.11", "http-body", "httparse", "httpdate", @@ -1049,7 +1069,7 @@ dependencies = [ "bytes", "encoding_rs", "futures-util", - "http", + "http 0.2.11", "httparse", "log", "memchr", @@ -1699,7 +1719,7 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 0.2.11", "httparse", "log", "rand", @@ -1787,7 +1807,7 @@ dependencies = [ "futures-channel", "futures-util", "headers", - "http", + "http 0.2.11", "hyper", "log", "mime", diff --git a/Cargo.toml b/Cargo.toml index 74e8fedc..62461b23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ gloo-utils = { version = "0.2", path = "crates/utils", optional = true } gloo-history = { version = "0.2", path = "crates/history", optional = true } gloo-worker = { version = "0.5", path = "crates/worker", optional = true } gloo-net = { version = "0.5", path = "crates/net", optional = true } +gloo-intl = { version = "0.1", path = "crates/intl", optional = true } [features] default = [ @@ -38,6 +39,7 @@ default = [ "history", "worker", "net", + "intl", ] futures = [ "timers", @@ -58,6 +60,7 @@ utils = ["gloo-utils"] history = ["gloo-history"] worker = ["gloo-worker"] net = ["gloo-net"] +intl = ["gloo-intl"] [workspace] members = [ @@ -73,6 +76,7 @@ members = [ "crates/worker", "crates/worker-macros", "crates/net", + "crates/intl", "examples/markdown", "examples/clock", diff --git a/crates/intl/Cargo.toml b/crates/intl/Cargo.toml new file mode 100644 index 00000000..d066f882 --- /dev/null +++ b/crates/intl/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "gloo-intl" +version = "0.1.0" +authors = [ + "Rust and WebAssembly Working Group", + # "Mendy Berger", +] +edition = "2021" +license = "MIT OR Apache-2.0" +repository = "https://github.com/rustwasm/gloo" +description = "Clean Intl API for WASM Apps" +readme = "README.md" +keywords = ["intl", "i18l", "Internationalization", "localization"] +categories = ["wasm", "api-bindings"] + +[dependencies] +wasm-bindgen = "0.2" +js-sys = "0.3" diff --git a/crates/intl/README.md b/crates/intl/README.md new file mode 100644 index 00000000..eb9839d9 --- /dev/null +++ b/crates/intl/README.md @@ -0,0 +1,24 @@ +
gloo-intl