From abcca75ea4d5cc2b2a2d4ad0f7c75c15dded3f39 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 19 Jan 2024 16:25:01 +0800 Subject: [PATCH] Fix README --- README.md | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/README.md b/README.md index 988d0aa..5939e87 100644 --- a/README.md +++ b/README.md @@ -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" @@ -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 @@ -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> { todo!() } -# } -# pub fn get(_url: &str) -> Result> { todo!() } -# } -# } -# use std::collections::HashMap; use rust_i18n::Backend; pub struct RemoteI18n { @@ -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()); ```