Skip to content

Commit

Permalink
Fix README
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Jan 19, 2024
1 parent aa3d0c1 commit abcca75
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ use rust_i18n::t;
Then, simply use it wherever a localized string is needed:

```rust,no_run
# fn _rust_i18n_translate(locale: &str, key: &str) -> String { todo!() }
# fn main() {
use rust_i18n::t;
t!("hello");
// => "Hello world"
Expand All @@ -181,7 +180,6 @@ t!("messages.hello", locale = "zh-CN", name = "Jason", count = 2);
t!("messages.hello", locale = "zh-CN", "name" => "Jason", "count" => 3 + 2);
// => "你好,Jason (5)"
# }
```

### Current Locale
Expand All @@ -202,16 +200,6 @@ Since v2.0.0 rust-i18n support extend backend for cusomize your translation impl
For example, you can use HTTP API for load translations from remote server:

```rust,no_run
# pub mod reqwest {
# pub mod blocking {
# pub struct Response;
# impl Response {
# pub fn text(&self) -> Result<String, Box<dyn std::error::Error>> { todo!() }
# }
# pub fn get(_url: &str) -> Result<Response, Box<dyn std::error::Error>> { todo!() }
# }
# }
# use std::collections::HashMap;
use rust_i18n::Backend;
pub struct RemoteI18n {
Expand Down Expand Up @@ -246,14 +234,6 @@ impl Backend for RemoteI18n {
Now you can init rust_i18n by extend your own backend:

```rust,no_run
# struct RemoteI18n;
# impl RemoteI18n {
# fn new() -> Self { todo!() }
# }
# impl rust_i18n::Backend for RemoteI18n {
# fn available_locales(&self) -> Vec<&str> { todo!() }
# fn translate(&self, locale: &str, key: &str) -> Option<&str> { todo!() }
# }
rust_i18n::i18n!("locales", backend = RemoteI18n::new());
```

Expand Down

0 comments on commit abcca75

Please sign in to comment.