diff --git a/Cargo.toml b/Cargo.toml index d2c8b7c..9474299 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,12 +10,12 @@ license = "MIT" name = "rust-i18n" readme = "README.md" repository = "https://github.com/longbridgeapp/rust-i18n" -version = "2.2.1" +version = "2.3.0" [dependencies] once_cell = "1.10.0" -rust-i18n-support = {path = "./crates/support", version = "2.1.0"} -rust-i18n-macro = {path = "./crates/macro", version = "2.1.0"} +rust-i18n-support = {path = "./crates/support", version = "2.3.0"} +rust-i18n-macro = {path = "./crates/macro", version = "2.3.0"} [dev-dependencies] foo = {path = "examples/foo"} diff --git a/Makefile b/Makefile index d1ca8bd..29b283b 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,8 @@ release\:support: cd crates/support && cargo release --no-dev-version --skip-tag --skip-push release\:extract: cd crates/extract && cargo release --no-dev-version --skip-tag --skip-push +release\:cli: + cd crates/cli && cargo release --no-dev-version --skip-tag --skip-push release: cargo release test: diff --git a/README.md b/README.md index 8ed5a54..74ae604 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ You can use `_version` key to specify the version of the locale file, and the de ### Split Localized Texts into Difference Files -> _version: 1 +> \_version: 1 You can also split the each language into difference files, and you can choise (YAML, JSON, TOML), for example: `en.json`: @@ -91,8 +91,8 @@ You can also split the each language into difference files, and you can choise ( ```yml _version: 1 -hello: "Hello world" -messages.hello: "Hello, %{name}" +hello: 'Hello world' +messages.hello: 'Hello, %{name}' ``` Or use JSON or TOML format, just rename the file to `en.json` or `en.toml`, and the content is like this: @@ -114,7 +114,7 @@ hello = "Hello, %{name}" ### All Localized Texts in One File -> _version: 2 +> \_version: 2 Make sure all localized files (containing the localized mappings) are located in the `locales/` folder of the project root directory: @@ -137,7 +137,6 @@ Make sure all localized files (containing the localized mappings) are located in In the localized files, specify the localization keys and their corresponding values, for example, in `app.yml`: - ```yml _version: 2 hello: @@ -273,19 +272,18 @@ I18n Ally is a VS Code extension for helping you translate your Rust project. You can add [i18n-ally-custom-framework.yml](https://github.com/longbridgeapp/rust-i18n/blob/main/.vscode/i18n-ally-custom-framework.yml) to your project `.vscode` directory, and then use I18n Ally can parse `t!` marco to show translate text in VS Code editor. - ## Extractor -> __Experimental__ +> **Experimental** We provided a `cargo i18n` command line tool for help you extract the untranslated texts from the source code and then write into YAML file. > In current only output YAML, and use `_version: 2` format. -You can install it via `cargo install rust-i18n`, then you get `cargo i18n` command. +You can install it via `cargo install rust-i18n-cli`, then you get `cargo i18n` command. ```bash -$ cargo install rust-i18n +$ cargo install rust-i18n-cli ``` ### Extractor Config @@ -309,7 +307,7 @@ $ cargo install rust-i18n Rust I18n providered a `i18n` bin for help you extract the untranslated texts from the source code and then write into YAML file. ```bash -$ cargo install rust-i18n +$ cargo install rust-i18n-cli # Now you have `cargo i18n` command ``` diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 2cbdd86..db9588b 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -5,14 +5,14 @@ license = "MIT" name = "rust-i18n-cli" readme = "../../README.md" repository = "https://github.com/longbridgeapp/rust-i18n" -version = "2.1.0" +version = "2.3.0" [dependencies] anyhow = "1" clap = { version = "4.1.14", features = ["derive"] } itertools = "0.11.0" -rust-i18n-support = { path = "../support", version = "2.1.0" } -rust-i18n-extract = { path = "../extract", version = "2.1.0" } +rust-i18n-support = { path = "../support", version = "2.3.0" } +rust-i18n-extract = { path = "../extract", version = "2.3.0" } serde = { version = "1", features = ["derive"] } toml = "0.7.4" diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 7da0a96..6690627 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -49,7 +49,7 @@ fn main() -> Result<(), Error> { let output_path = Path::new(&source_path).join(&cfg.load_path); - let result = generator::generate(&output_path, &cfg.available_locales, messages.clone()); + let result = generator::generate(output_path, &cfg.available_locales, messages.clone()); if result.is_err() { has_error = true; } diff --git a/crates/extract/Cargo.toml b/crates/extract/Cargo.toml index 5db5f5b..153ec6f 100644 --- a/crates/extract/Cargo.toml +++ b/crates/extract/Cargo.toml @@ -5,7 +5,7 @@ license = "MIT" name = "rust-i18n-extract" readme = "../../README.md" repository = "https://github.com/longbridgeapp/rust-i18n" -version = "2.1.0" +version = "2.3.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -15,7 +15,7 @@ ignore = "0.4" proc-macro2 = { version = "1", features = ["span-locations"] } quote = "1" regex = "1" -rust-i18n-support = { path = "../support", version = "2.1.0" } +rust-i18n-support = { path = "../support", version = "2.3.0" } serde = "1" serde_json = "1" serde_yaml = "0.8" diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index e9e9d0c..64a3cf1 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -5,7 +5,7 @@ license = "MIT" name = "rust-i18n-macro" readme = "../../README.md" repository = "https://github.com/longbridgeapp/rust-i18n" -version = "2.1.0" +version = "2.3.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -14,14 +14,14 @@ glob = "0.3" once_cell = "1.10.0" proc-macro2 = "1.0" quote = "1.0.2" -rust-i18n-support = { path = "../support", version = "2.1.0" } +rust-i18n-support = { path = "../support", version = "2.3.0" } serde = "1" serde_json = "1" serde_yaml = "0.8" syn = "2.0.18" [dev-dependencies] -rust-i18n = { path = "../..", version = "*" } +rust-i18n = { path = "../.." } [lib] proc-macro = true diff --git a/crates/support/Cargo.toml b/crates/support/Cargo.toml index 31eb085..7df8a80 100644 --- a/crates/support/Cargo.toml +++ b/crates/support/Cargo.toml @@ -5,7 +5,7 @@ license = "MIT" name = "rust-i18n-support" readme = "../../README.md" repository = "https://github.com/longbridgeapp/rust-i18n" -version = "2.1.0" +version = "2.3.0" [dependencies] globwalk = "0.8.1"