diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index d8b2ae3..378f291 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -324,8 +324,6 @@ fn generate_code( quote! { use rust_i18n::{BackendExt, CowStr, MinifyKey}; use std::borrow::Cow; - use std::sync::Mutex; - use rust_i18n::once_cell::sync::Lazy; /// I18n backend instance /// @@ -335,18 +333,11 @@ fn generate_code( let mut backend = rust_i18n::SimpleBackend::new(); #(#all_translations)* #extend_code - - if *_RUST_I18N_INITIALIZED_DEFAULT_LOCALE.lock().unwrap() == false { - *_RUST_I18N_INITIALIZED_DEFAULT_LOCALE.lock().unwrap() = true; - #default_locale - } + #default_locale Box::new(backend) }); - /// To mark the default locale has been initialized - static _RUST_I18N_INITIALIZED_DEFAULT_LOCALE: Lazy> = Lazy::new(|| Mutex::new(false)); - static _RUST_I18N_FALLBACK_LOCALE: Option<&[&'static str]> = #fallback; static _RUST_I18N_MINIFY_KEY: bool = #minify_key; static _RUST_I18N_MINIFY_KEY_LEN: usize = #minify_key_len;