diff --git a/Cargo.toml b/Cargo.toml index 77c6f84..8436bb7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,19 +16,19 @@ license = "MIT" name = "rust-i18n" readme = "README.md" repository = "https://github.com/longbridgeapp/rust-i18n" -version = "3.1.0" +version = "3.1.1" [dependencies] once_cell = "1.10.0" -rust-i18n-support = { path = "./crates/support", version = "3.0.1" } -rust-i18n-macro = { path = "./crates/macro", version = "3.0.0" } +rust-i18n-support = { path = "./crates/support", version = "3.1.0" } +rust-i18n-macro = { path = "./crates/macro", version = "3.1.0" } smallvec = "1.12.0" [dev-dependencies] foo = { path = "examples/foo" } criterion = "0.5" lazy_static = "1" -serde_yaml = "0.8" +serde_yml = "0.0.11" [build-dependencies] globwalk = "0.8.1" diff --git a/README.md b/README.md index 1b94e8e..8c619d4 100644 --- a/README.md +++ b/README.md @@ -264,7 +264,7 @@ impl RemoteI18n { fn new() -> Self { // fetch translations from remote URL let response = reqwest::blocking::get("https://your-host.com/assets/locales.yml").unwrap(); - let trs = serde_yaml::from_str::>>(&response.text().unwrap()).unwrap(); + let trs = serde_yml::from_str::>>(&response.text().unwrap()).unwrap(); return Self { trs diff --git a/crates/extract/Cargo.toml b/crates/extract/Cargo.toml index 867fb52..c59931c 100644 --- a/crates/extract/Cargo.toml +++ b/crates/extract/Cargo.toml @@ -18,7 +18,7 @@ regex = "1" rust-i18n-support = { path = "../support", version = "3.0.0" } serde = "1" serde_json = "1" -serde_yaml = "0.8" +serde_yml = "0.0.11" syn = { version = "2.0.18", features = ["full"] } toml = "0.7.4" diff --git a/crates/extract/src/generator.rs b/crates/extract/src/generator.rs index b378708..5cd308e 100644 --- a/crates/extract/src/generator.rs +++ b/crates/extract/src/generator.rs @@ -50,7 +50,7 @@ fn convert_text(trs: &Translations, format: &str) -> String { match format { "json" => serde_json::to_string_pretty(&value).unwrap(), "yaml" | "yml" => { - let text = serde_yaml::to_string(&value).unwrap(); + let text = serde_yml::to_string(&value).unwrap(); // Remove leading `---` text.trim_start_matches("---").trim_start().to_string() } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index 2b4868e..586dac9 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -17,7 +17,7 @@ quote = "1.0.2" rust-i18n-support = { path = "../support", version = "3.0.0" } serde = "1" serde_json = "1" -serde_yaml = "0.8" +serde_yml = "0.0.11" syn = { version = "2.0.18", features = ["full", "extra-traits"] } [dev-dependencies] diff --git a/crates/support/Cargo.toml b/crates/support/Cargo.toml index d2ab753..9e93f5d 100644 --- a/crates/support/Cargo.toml +++ b/crates/support/Cargo.toml @@ -16,7 +16,7 @@ once_cell = "1.10.0" proc-macro2 = "1.0" serde = { version = "1", features = ["derive"] } serde_json = "1" -serde_yaml = "0.8" +serde_yml = "0.0.11" siphasher = "1.0" toml = "0.7.4" normpath = "1.1.1" diff --git a/crates/support/src/lib.rs b/crates/support/src/lib.rs index 24a4ecc..3c8ccfe 100644 --- a/crates/support/src/lib.rs +++ b/crates/support/src/lib.rs @@ -126,7 +126,7 @@ pub fn load_locales bool>( // Parse Translations from file to support multiple formats fn parse_file(content: &str, ext: &str, locale: &str) -> Result { let result = match ext { - "yml" | "yaml" => serde_yaml::from_str::(content) + "yml" | "yaml" => serde_yml::from_str::(content) .map_err(|err| format!("Invalid YAML format, {}", err)), "json" => serde_json::from_str::(content) .map_err(|err| format!("Invalid JSON format, {}", err)), @@ -355,14 +355,14 @@ mod tests { #[test] fn test_get_version() { - let json = serde_yaml::from_str::("_version: 2").unwrap(); + let json = serde_yml::from_str::("_version: 2").unwrap(); assert_eq!(super::get_version(&json), 2); - let json = serde_yaml::from_str::("_version: 1").unwrap(); + let json = serde_yml::from_str::("_version: 1").unwrap(); assert_eq!(super::get_version(&json), 1); // Default fallback to 1 - let json = serde_yaml::from_str::("foo: Foo").unwrap(); + let json = serde_yml::from_str::("foo: Foo").unwrap(); assert_eq!(super::get_version(&json), 1); }