Skip to content

Commit

Permalink
version 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Nov 14, 2023
1 parent 470d99b commit 2111326
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

Expand All @@ -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:
Expand All @@ -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:

Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
```

Expand Down
6 changes: 3 additions & 3 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/extract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions crates/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
2 changes: 1 addition & 1 deletion crates/support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 2111326

Please sign in to comment.